Find First Even NumberEasy

Find First Even Number

EasyPractice library · +10 XPtwo pointersarrayssearching

Given a list of N integers, find the value of the first even number that appears in the list. If no even numbers are present, output -1.

Input

The first line contains an integer N. The second line contains N space-separated integers.

Output

Print the first even number found in the list, or -1 if no even numbers exist.

Constraints

1 <= N <= 1000. Each integer will be between -1000 and 1000.

Time limit 1 s (native code; slower languages get more)Memory 256 MB13 hidden tests

Example 1

Input
5
1 3 5 7 9
Output
-1

No even numbers in the list, so -1 is printed.

Example 2

Input
6
2 4 1 3 6 8
Output
2

The first even number is 2.

Hints