#include <bits/stdc++.h>
using namespace std;
long long n, ans = 0;
long long a[300005], pre[300005], precnt[300005][2];
signed main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long x, cnt = 0;
    cin >> x;
    while (x) cnt += (x & 1), x >>= 1;
    a[i] = cnt % 2;
  }
  for (long long i = 1; i <= n; i++) pre[i] = (pre[i - 1] + a[i]) % 2;
  precnt[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j < 2; j++) precnt[i][j] = precnt[i - 1][j];
    precnt[i][pre[i]]++;
  }
  for (long long i = 2; i <= n; i++) ans += precnt[i - 2][pre[i]];
  cout << ans << endl;
  return 0;
}
