#K65817. Equal Even-Odd Parity Check
Equal Even-Odd Parity Check
Equal Even-Odd Parity Check
You are given a list of integers. Your task is to determine whether the list contains an equal number of even and odd numbers.
Formally, let \( E \) be the number of even integers and \( O \) be the number of odd integers in the list. You need to check if \( E = O \). If true, output YES
; otherwise, output NO
.
The input is read from stdin and the output must be written to stdout.
inputFormat
The input consists of two lines:
- The first line contains an integer \( n \) (\(1 \leq n \leq 10^6\)), representing the number of integers in the list.
- The second line contains \( n \) space-separated integers. Each integer \( a_i \) satisfies \( |a_i| \leq 10^9 \).
outputFormat
Output a single line containing YES
if the number of even integers is equal to the number of odd integers, otherwise output NO
.
4
1 2 3 4
YES