t = int(input())
s = [int(i) for i in input().split()]
total = sum(s)
even_count = 0
odd_count = 0
for i in s:
if i % 2 == 0:
even_count += 1
else:
odd_count += 1
if t % 2 == 0:
if total % 2 == 0:
print(t - odd_count)
else:
print(odd_count)
else:
if total % 2 == 0:
print(even_count)
else:
print(odd_count)
#include<bits/stdc++.h>
using namespace std ;
int main(){
int n;
cin>>n;
int arr[n];
int odd=0,even=0;
for (int i = 0; i < n; i++)
{
cin>>arr[i];
if (arr[i]%2==1)
{
odd++;
}
}
even=n-odd;
if (odd%2==0)
{
cout<<even<<endl;
}
else{
cout<<odd<<endl;
}
}
964A - Splits | 1615A - Closing The Gap |
4C - Registration System | 1321A - Contest for Robots |
1451A - Subtract or Divide | 1B - Spreadsheet |
1177A - Digits Sequence (Easy Edition) | 1579A - Casimir's String Solitaire |
287B - Pipeline | 510A - Fox And Snake |
1520B - Ordinary Numbers | 1624A - Plus One on the Subset |
350A - TL | 1487A - Arena |
1520D - Same Differences | 376A - Lever |
1305A - Kuroni and the Gifts | 1609A - Divide and Multiply |
149B - Martian Clock | 205A - Little Elephant and Rozdil |
1609B - William the Vigilant | 978B - File Name |
1426B - Symmetric Matrix | 732B - Cormen --- The Best Friend Of a Man |
1369A - FashionabLee | 1474B - Different Divisors |
1632B - Roof Construction | 388A - Fox and Box Accumulation |
451A - Game With Sticks | 768A - Oath of the Night's Watch |