#K95377. Even Sum Pairs

    ID: 38850 Type: Default 1000ms 256MiB

Even Sum Pairs

Even Sum Pairs

In this problem, you are given an array of integers. Your task is to count the number of pairs \((i, j)\) such that \(1 \leq i < j \leq N\) and the sum \(A[i] + A[j]\) is even.

The sum of two integers is even if either both integers are even or both are odd. For example, when \(A = [1, 2, 3, 4, 5]\), the valid pairs are \((1, 3)\), \((1, 5)\), \((2, 4)\), and \((3, 5)\) which gives an answer of 4.

inputFormat

The input is given from standard input (stdin) and consists of two lines. The first line contains an integer \(N\), representing the number of elements in the array. The second line contains \(N\) space-separated integers representing the array \(A\).

outputFormat

Output a single integer from standard output (stdout) which is the number of pairs \((i, j)\) where the sum of the corresponding elements is even.

## sample
5
1 2 3 4 5
4

</p>