Help in calculating Partition function and choosing the ensemble I've been given this situation 

"A surface contains $N$ identical atoms in a fixed position. Every atom can occupy one of two states with energies $E_1$ or $E_2$ and the temperature is $T$."

For the solution, I am uncertain what kind of ensemble to use
seeing as it is a surface, I would imagine it to be a 2-dimensional surface of a classical continuous system on the form of a canonical ensemble. Which would take the form
$Z=\frac{1}{h^2}\int d^2 r \int d^2 p\exp{(-\beta\cdot E(r,p))}$
For $h=\Delta x\Delta p$
However, the verbal communication with the professor indicates a solution on the form of
$Z=Z_1^N=(e^{-\beta\cdot E_1}+e^{-\beta\cdot E_2})^N$
I do not really the professor's solution, the first partition function would give a different result than his answer.
Can anyone help?
 A: The system is in contact with a heat bath at a fixed temperature, so the connonical ensamble is the correct choice, but the degrees of freedom in your system are not the position and momentum of particles, so the integral you wrote down does not make any sense. Instead your degrees of freedom are whether a given atom is in state 1 or state 2. 
In general the partition function has the form 
$$
Z = \sum_{\gamma\in\Gamma} e^{-\beta E_\gamma}
$$
where $\Gamma$ is the set of possible microstates of the system and $E_\gamma$ are the corresponding energies. If the possible microstates can be characterised by a set of continuous variables, then the sum turns in to an integral of the form you wrote down in your question. In this case however we have a discrete set of variables, so the sums remain discrete. 
The set of sates we are dealing with can be characterised by listing the states of each of $N$ atoms, for example $\gamma = (1,1,2,1,2,1...)$ and the corresponding energies are given by adding up the energies for each atom $E_\gamma = \sum_{n=1}^N E^{(n)}$ where $E^{(n)}$ is $E_1$ if atom $n$ is in state $1$ and $E_2$ is it is in state $2$. 
From here the thing to notice is that since the energy of each atom is independant of the state of any other atom, we can pull appart the sum over $\Gamma$ into $N$ sums over the state of each indivdual atom
$$
\sum_{\gamma\in\Gamma} = \sum_{\gamma_1\in\{1,2\}}\sum_{\gamma_2\in\{1,2\}}...\sum_{\gamma_N\in\{1,2\}}
$$
I will leave the algebra of getting from here to the expression your professor wrote down to you. 
