Put $f_n(x)=\left\{\cos (\pi f(x))\right\}^{2n}$. Then the sequence $\{f_n\}$ is decreasing, and $0\leq f_1\leq 1$, which is integrable. Hence we can apply the reversed version of the monotone convergence theorem, which gives $\lim_{n\to\infty}\int_X f_n(x)d\mu(x)=\int_X \lim_{n\to\infty}f_n(x)d\mu(x).$ Since $\left\{\cos(\pi f(x))\right\}^2=1$ if $f(x)\in\mathbb Z$, and $\left\{\cos(\pi f(x))\right\}^2<1$ otherwise, we have $\lim_{n\to\infty}f_n(x)=\begin{cases}1&\mbox{if }f(x)\in\mathbb Z\\ 0&\mbox{otherwise},\end{cases}$
so $\lim_{n\to +\infty}\int_X\left\{\cos (\pi f(x))\right\}^{2n}d\mu(x)=\int_X\mathbf 1_{\left\{f(x)\in\mathbb Z\right\}}d\mu(x)=\sum_{k\in\mathbb Z}\mu(\left\{x\in X,f(x)=k\right\}).$