Where does this equation for the activity in the gas phase equilibrium between N₂, H₂ and NH₃ come from? I have a question with Equilibrium Constant.

I understand that for a reaction in equilibrium $aA +bB \rightleftharpoons cC +dD$
$$K_c= \frac{[C]^c[D]^d}{[A]^a[B]^b}$$
and $K_p$ is just using the partial pressures. 

I'm looking through my PChem1 tutorials and I saw that they wrote for 

$$\ce{1/2 N2 + 3/2 H2 &lt;=&gt; NH_3}$$
$$K=\frac{a(NH_3)}{a(N_2)^\frac12a(H_2)^\frac32}$$

I believe that a represents activity. However what i don't get is what follows:
$$K=\frac{a(NH_3)}{a(N_2)^\frac12a(H_2)^\frac32}=\frac{\left(\frac{n(NH_3)RT}{p_oV}\right)}{\left(\frac{n(N_2)RT}{p_0V}\right)^\frac12\left(\frac{n(H_2)RT}{p_oV}\right)^\frac32}=\frac{n(NH_3)}{n(N_2)^\frac12n(H_2)^\frac32}\left(\frac{p_oV}{RT}\right)$$

I cant' figure out how $a(NH_3)=\frac{n(NH_3)RT}{p_oV}$

It obviously has something to do with the ideal gas equation $pV=nRT$ but I don't get how.

additional context:
The question asks for the equilibrium composition starting with 1 mol each of $\ce{N_2}$, $\ce{H_2}$ and $\ce{NH_3}$ in a 1L reaction vessel at 298K

P.s. I get that I am to use extent of reaction to solve this.
The activity of a molecule $\ce{M}$ as a function of its concentration in the solution can be written as

\begin{equation}
  a_{\ce{M}} = \frac{\gamma_{\ce{M}} c_{\ce{M}}}{c^0} \ ,
\end{equation}

where $c^0$ is the standard concentration and $\gamma_{\ce{M}}$ is the (dimensionless) activity coefficient (see also: here and Wikipedia).
If you have a sufficiently dilute solution so that non-ideal contributions become very small, the activity coefficient can be approximated by 1, i.e. $\gamma_{\ce{M}} \approx 1$.
So, what you're left with for the activity under these conditions is

\begin{equation}
  a_{\ce{M}} \approx \frac{c_{\ce{M}}}{c^0} \ ,
\end{equation}

Now, the concentration is defined by $c = \frac{n}{V}$ and with the ideal gas law $\frac{n}{V} = \frac{p}{RT}$ you get:

\begin{align}
  a_{\ce{M}} &amp;\approx \frac{c_{\ce{M}}}{c^0} = \frac{\frac{n_{\ce{M}}}{V}}{\frac{n^0}{V}} \\
  &amp;= \frac{\frac{n_{\ce{M}}}{V}}{\frac{p^{0}}{RT}} = \frac{n_{\ce{M}} R T}{p^{0} V}
\end{align}

where $p^{0}$ is the standard pressure.