n = int(input())
a = list(map(int, input().split()))
cnt_even = cnt_odd = 0
for i in range(n):
if a[i] % 2 == 0:
cnt_even += 1
else:
cnt_odd += 1
result = 0
check = True
if cnt_odd % 2 == 0:
check = False
for i in range(n):
if check == True:
if a[i] % 2 == 0:
cnt_even -= 1
result += cnt_odd
else:
cnt_odd -= 1
result += cnt_even
else:
if a[i] % 2 == 0:
cnt_even -= 1
result += cnt_even
else:
cnt_odd -= 1
result += cnt_odd
print(result)