function n = solve_for_n(n0, mu_z, mu_f, k_n, gamma, lambda_w,  ...
                         varphi, alpha, tau_n, tau_c, h, w_hat,chi,...
                         kappa_I, delta, g, x)
% anonymous function
myfun = @(n) n*(1/(mu_z*mu_f))^alpha*k_n^alpha - (1-gamma)*(1/lambda_w)*mu_z*(1-tau_n)/((mu_z - h)*(1 + tau_c))*w_hat*n^(-varphi)/chi...
    - n*(1-gamma)*k_n*(1 - (1-delta)/(mu_z*mu_f))/(1 - kappa_I/2*(mu_z*mu_f - 1)^2) - g - x;
n = fzero(myfun, n0);
    
    