I'll give some hints:
1) Notice that $X_i^2 = X_i$, since $X_i$ is $0$ or $1$. Then,
$E X_i = 0 \cdot \mathrm{P}(X_i=0) + 1 \cdot \mathrm{P}(X_i = 1) = \mathrm{P}(X_i = 1)$. What is this probability?
2) Again, $X_i X_j$ is $0$ or $1$. Notice that $X_i X_j = 1$ if and only if person $i$ gets their hat AND person $j$ gets their hat. What is the probability of this? Let $A$ be the event person $i$ gets his hat and $B$ be the event person $j$ does. Then
$$ \mathrm{P}(X_i X_j = 1) = \mathrm{P}(A \cap B) = \mathrm{P}(A) \mathrm{P}(B|A) $$
What are $\mathrm{P}(A)$ and $\mathrm{P}(B|A)$?
3) After some algebra,
$E S_n^2 = E(\sum_{i=1}^n X_i )^2 = E(\sum_{i=1}^n X_i^2 + \sum_{i \neq j} X_i X_j)$
Distribute the $E$ through. Use 1) and 2). How many ways can $i \neq j$?
4) $\mathrm{Var} S_n = E S_n^2 - (E S_n)^2$