What is the formula for the intensity of light, and how are amplitude, frequency and number of photons considered?

One formula for light intensity is$$I = \frac{nfh}{At} \,,$$where:

• $$n$$ is the number of photons;

• $$h$$ is Planck's constant;

• $$f$$ is the frequency;

• $$A$$ is the incident area;

• $$t$$ is time.

Another formula describes intensity as a function of the magnitude of electric field squared:

$$I\left(t\right) \propto \left|E\left(t\right)\right|^2$$

$$I=\left|S\right|=\frac{\left|E\right|^2}{Z_0}$$

How do I reconcile these two formulas?

An electromagnetic wave is composed of an oscillating electric and magnetic fields, which are orthogonal. Our field equations might be described by $$\mathbf{E}(x,t) = {E_0}\sin\left(kx-\omega t\right)\mathbf{\hat x}$$ and $$\mathbf{B}(x,t) = {B_0}\sin\left(kx-\omega t\right)\mathbf{\hat y}.$$ Here the frequency is given by $f = \frac{2\pi}{\omega}$ and the wavelength by $\lambda = \frac{2\pi}{k}$. The amplitues are given by $E_0$ and $B_0$. These equations form a plane wave which has a total intensity, at any point in time, as given by the Poynting vector $$\mathbf{S} = \frac{1}{\mu_0}\left(\mathbf{E} \times \mathbf{B}\right).$$ The time-average of the Poynting vector turns out to be $$I(t) = \left< \mathbf{S}(t) \right> = \frac{1}{2c\mu_0} E_0^2.$$
The intensity is defined as power per unit area, and power is defined as energy per unit time. Thus: $$I = \frac{P}{A} = \frac{E}{\Delta t} \frac{1}{A}.$$ The energy of a photon is $E = hf$, so the total intensity for $n$ photons is $$I = n \cdot \frac{hf}{A\Delta t}.$$ In this model, photons are only counted, and not seen as waves. Thus there is no amplitude to be considered.