#include using namespace std; const int INF = 1000000000; template struct ford_fulkerson{ struct edge{ int to, rev; Cap cap; edge(int to, int rev, Cap cap): to(to), rev(rev), cap(cap){ } }; int N; vector> G; ford_fulkerson(){ } ford_fulkerson(int N): N(N), G(N){ } void add_edge(int from, int to, Cap cap){ int id1 = G[from].size(); int id2 = G[to].size(); G[from].push_back(edge(to, id2, cap)); G[to].push_back(edge(from, id1, 0)); } Cap max_flow(int s, int t){ Cap flow = 0; while (1){ vector m(N, INF); vector pv(N, -1); vector pe(N, -1); vector used(N, false); queue Q; Q.push(s); used[s] = true; while (!Q.empty()){ int v = Q.front(); Q.pop(); int cnt = G[v].size(); for (int i = 0; i < cnt; i++){ int w = G[v][i].to; if (!used[w] && G[v][i].cap > 0){ used[w] = true; m[w] = min(m[v], G[v][i].cap); pv[w] = v; pe[w] = i; Q.push(w); } } } if (!used[t]){ break; } Cap f = m[t]; for (int i = t; i != s; i = pv[i]){ G[pv[i]][pe[i]].cap -= f; G[i][G[pv[i]][pe[i]].rev].cap += f; } flow += f; } return flow; } }; int main(){ int N; cin >> N; vector A(N); for (int i = 0; i < N; i++){ cin >> A[i]; } map mp; for (int i = 0; i < N; i++){ mp[A[i]]++; } vector B, C; int M = 0; for (auto P : mp){ M++; B.push_back(P.first); C.push_back(P.second); } ford_fulkerson G(M + 2); for (int i = 0; i < M; i++){ if (__builtin_parity(B[i]) == 0){ for (int j = 0; j < M; j++){ if (__builtin_popcount(B[i] ^ B[j]) == 1){ G.add_edge(i, j, C[i] * C[j]); } } } } for (int i = 0; i < M; i++){ if (__builtin_parity(B[i]) == 0){ G.add_edge(M, i, C[i]); } else { G.add_edge(i, M + 1, C[i]); } } cout << N - G.max_flow(M, M + 1) << endl; }