Cardinal of a set of functions between two finite sets of integers 
Let $ A= \{a_1, a_2, a_3,\cdots, a_{10}\}$, $B=\{ 1,2 \}$. Find the number of functions $ f: A \to B $ such that $ f(a_1) +f(a_2)+\cdots+f(a_{10})$ is an even number.

I have tried to find the number of functions $ 2^{10} $ But not getting any clue to find the functions under such conditions.

To see it as an arrangement problem. Let our mapping be permutations of $\{1, 1, 1, 1, 1, 1, 1, 1, 1, 1\}, \{2, 1, 1, 1, 1, 1, 1, 1, 1, 1\}, \{2, 2, 1, 1, 1, 1, 1, 1, 1, 1\}$ and so on...  
To get an even number as the output you need to select permutations of sets that have even number of one's. Let $P_{10}$ be permutations of $\{1, 1, 1, 1, 1, 1, 1, 1, 1, 1\}$, $P_{9}$ be permutations of $\{2, 1, 1, 1, 1, 1, 1, 1, 1, 1\}$ and so on..
$$\
\text{Required Permutations}=P_0+P_2+P_4+P_6+P_8+P_{10}
$$
You can compute each term and find the answer or you can use symmetry and argue that this will be equal to $\frac{2^{10}}{2}$ as pointed out by mathcounterexamples.net
