\frac{N_i}{N_f}=\frac{g_i}{g_f}e^{-\frac{E_i-E_f}{k_BT}}