#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int n, odd[maxn];
long long a, ans, cnt0, cnt1;
inline long long rd() {
  long long res = 0;
  int f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) res = (res << 3) + (res << 1) + ch - 48;
  return res * f;
}
inline int sep(long long x) {
  int cnt = 0;
  while (x) {
    if (x & 1) ++cnt;
    x >>= 1;
  }
  return cnt % 2;
}
int main() {
  n = rd();
  for (register int i = 1; i <= n; ++i) {
    a = rd();
    odd[i] = sep(a);
  }
  long long now = 0;
  for (register int i = 1; i <= n; ++i) {
    if (odd[i]) {
      now = cnt1;
      swap(cnt0, cnt1);
      ++cnt1;
      ans += now;
    } else {
      now = cnt0;
      ++cnt0;
      ans += now;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
