Logic formula for exactly n unique objects (no more, no less)
You need to say that (a) there are at least $n$ elements, and (b) there are at most $n$ elements. 
To express (a),
$$
L_n := \exists x_1\dotsc \exists x_n\, \left( \bigwedge_{1\le i &lt; j \le n} x_i\ne x_j \right).
$$
To express (b),
$$
M_n := \forall x_1\dotsc \forall x_{n+1}\, \left( \bigvee_{1\le i &lt; j \le n+1}x_i = x_j\right).
$$
So the sentence $L_n \land M_n$ holds iff there are exactly $n$ elements.