Write $X = \sum_{i=1}^n X_i$ and $Y = \sum_{j=1}^n Y_j$ where $X_i = 1$ if the i-th roll is a 1 and zero otherwise. Similarly, $Y_j = 1$ if the j-th roll is a 2 and zero otherwise.
Then $cov(X, Y) = \sum_{i,j} cov(X_i, Y_j)$. Next compute
$cov(X_i, Y_j) = E(X_iY_j) - E(X_i)E(Y_j)$. Note that $E(X_iY_j)$ is non-zero only when $i \neq j$.