#include<bits/stdc++.h>
using namespace std;

using ll = long long;

signed main(){
    ll n,od=0,ev=0,ans=0;cin>>n;
    for(int i=0;i<n;i++){
        ll x;cin>>x;
        if(x%2==0){
            ev++;
        }else{
            od++;
        }
    }

    if(!od || !ev){
        cout<<0<<endl;
        return 0;
    }

    ans+=(od-1)/2;
    ev+=(od-1)/2;

    ans+=ev;

    cout<<ans<<endl;

}
