Back/Traversal: Even Counter

Traversal: Even Counter

EasyLevel: 9Topic: Trees
XP Reward:+50 XPCoin Reward:+5 Coins

You are given a list of integers. Count how many of them are even.

This problem is part of Trees practice and is designed to strengthen the Traversal pattern.

Input Format

  • The first line contains an integer n, the number of values.
  • The second line contains n space-separated integers.

Output Format

Return one integer: the number of even values.

Example 1

Input:

9
-5 15 35 55 -22 -2 18 38 58

Output:

5

Explanation:

  • The even values are -22, -2, 18, 38, 58.
  • There are 5 even values, so the answer is 5.

Constraints

  • 1 <= n <= 10^5
  • -10^9 <= value <= 10^9

Return Requirement

Implement the starter function for this Easy problem. Read from the raw input string and return only the required answer, with no labels or debug text.

Judge Behavior

Run Code checks the visible sample cases. Submit checks those samples plus additional hidden cases that follow the same input format and constraints.

Loading editor...
Input
9
-5 15 35 55 -22 -2 18 38 58
Expected Output
5