All tasks
Easyarraysloopsmath

Sum of Even Elements

Time limit 2 s · Memory 64 MBAcceptance: 100.0%Solved by: 1

Statement

The first line contains n, the second line contains n integers. Print the sum of the even elements. If there are none, print 0. Zero counts as even.

Examples

Example 1
Input
5
1 2 3 4 5
Output
6
Example 2
Input
3
1 3 5
Output
0

Constraints

  • 1 ≤ n ≤ 10^5
  • -10^9 ≤ a_i ≤ 10^9
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.