Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
611 B
2
Indexable
Never
#include <iostream>
#include <ctime>

typedef long long ll;
using namespace std;

ll gt(int n){
    if(n==0) return 1;
    return n*gt(n-1);
}
ll th(int k, int n){
    ll s = 1;
    for(int i = n-k+1; i <= n; i++)
        s *= i;
    return s/gt(k);
}

int main(){
    freopen("quick.inp","r",stdin);
    freopen("quick.out","w",stdout);

    int c, l = 0;
    int n; cin >> n;
    for(int i = 0; i < n; i++){
        int t; cin >> t;
        if(t%2 != 0) ++l;
    }
    c = n-l;
    if(l%2 == 0) cout << th(2,c)+th(2,l) << endl;
    else cout << 1ll*c*l << endl;

	return 0;
}
Leave a Comment