#C6466. Even Sum Pairs

    ID: 50229 Type: Default 1000ms 256MiB

Even Sum Pairs

Even Sum Pairs

You are given an integer array of size \( n \). Your task is to count the number of unique pairs \( (i, j) \) such that \( 1 \leq i < j \leq n \) and the sum \( a_i + a_j \) is even. In other words, compute the number of pairs of elements that add up to an even number.

Hint: A sum of two integers is even if both are even or both are odd.

inputFormat

The input is read from stdin and consists of two lines:

  • The first line contains a single integer \( n \), representing the number of elements in the array.
  • The second line contains \( n \) space-separated integers representing the array elements.

outputFormat

Output to stdout a single integer which is the number of unique pairs \( (i, j) \) for which the sum of the two numbers is even.

## sample
5
1 2 3 4 5
4