#include <bits/stdc++.h>
using namespace std;
int n, odd[300500], even[300500], num[300500], pre[300500];
void read() {
  char ch;
  bool ok;
  int x;
  for (ok = 0, ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') ok = 1;
  for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  if (ok) x = -x;
}
int get1(long long x) {
  int ans = 0;
  while (x) {
    int tmp = x % 2;
    if (tmp) ans++;
    x /= 2;
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  int i;
  memset(odd, 0, sizeof(odd));
  memset(even, 0, sizeof(even));
  memset(pre, 0, sizeof(pre));
  for (i = 1; i <= n; i++) {
    long long x;
    scanf("%I64d", &x);
    num[i] = get1(x);
    pre[i] = pre[i - 1] + num[i];
    if (pre[i] % 2)
      odd[i]++;
    else
      even[i]++;
    odd[i] += odd[i - 1];
    even[i] += even[i - 1];
  }
  long long ans = 0;
  for (i = 0; i <= n; i++)
    if (pre[i] % 2)
      ans += (odd[n] - odd[i]);
    else
      ans += (even[n] - even[i]);
  for (i = 1; i <= n; i++) {
    int maxd = -1, j;
    for (j = i; j <= min(i + 65, n); j++) {
      int tmp = pre[j] - pre[i - 1];
      maxd = max(maxd, num[j]);
      if ((maxd * 2 > tmp) && (tmp % 2 == 0)) ans--;
    }
  }
  printf("%I64d", ans);
  return 0;
}
