본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 25629번 홀짝 수열

by 현장 2023. 4. 1.

-Code

from math import ceil

t = int(input())
nums = list(map(int, input().split()))

even, odd = 0, 0

for n in nums:
    if n % 2 != 0:
        odd += 1
    else:
        even += 1

print(1 if odd == ceil(t / 2) and even == t // 2 else 0)