#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000")
#pragma GCC target(arch = corie7 - acx)
#pragma GCC optimize(2)
using namespace std;
int n, s1, s0, a[3000001];
long long x, ans, s[3000001];
long long lowbit(long long x) { return x & (-x); }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &x);
    for (; x; x -= lowbit(x)) a[i]++;
    s[i] = s[i - 1] + a[i];
    s[i] &= 1;
  }
  s0 = 1;
  for (int i = 1; i <= n; i++)
    if (s[i])
      s1++;
    else
      s0++;
  ans = (long long)s1 * (s1 - 1) / 2 + (long long)s0 * (s0 - 1) / 2;
  for (int i = 1; i <= n; i++)
    if (!s[i] && !s[i - 1]) ans--;
  printf("%lld", ans);
  return 0;
}
