#include #include using namespace std; using namespace atcoder; int popcount(int a) { if (a == 0) return 0; return popcount(a / 2) + a % 2; } int main() { int n; cin >> n; assert(1 <= n && n <= 2000); vector a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; assert(0 <= a[i] && a[i] < 1 << 30); } mf_graph g(n + 2); int s = n; int t = n + 1; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if (popcount(a[i]) % 2 == 0 && popcount(a[j]) % 2 == 1 && popcount(a[i] ^ a[j]) ==1) { g.add_edge(i, j, 1); } } } for (int i = 0; i < n; ++i) if (popcount(a[i]) % 2 == 0) g.add_edge(s, i, 1); for (int i = 0; i < n; ++i) if (popcount(a[i]) % 2 == 1) g.add_edge(i, t, 1); cout << n-g.flow(s, t) << endl; return 0; }