#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define mod 1000000007

int main(){
  ll a=0,b=0;
  ll n,x;
  cin>>n;
  for(int i=0;i<n;i++){
      cin>>x;
      if(x%2==0)a++;
      else b++;
  }
  if(a==0||b==0){
      cout<<0<<endl;
  }
  else{
      cout<<(b-1)/2*2+a<<endl;
  }
  return 0;
}

