#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> lst(n);
for (int i = 0; i < n; i++) {
cin >> lst[i];
}
vector<int> odd;
vector<int> even;
bool odd_len = true;
for (int i = 0; i < n; i++) {
if (lst[i] % 2 == 0) {
if (odd_len == true) {
even.push_back(lst[i]);
}
} else {
odd.push_back(lst[i]);
odd_len = false;
int jug = 0;
for (int j = 0; j < odd.size(); j++) {
jug += odd[j];
}
if (jug % 2 == 0) {
odd_len = true;
even.push_back(jug);
}
}
}
int ans;
if (odd_len == true) {
ans = even.size();
} else {
ans = -1;
}
cout << ans << endl;
return 0;
}