#include <bits/stdc++.h>
using namespace std;
const int MAX = 3e5 + 5;
int n;
long long ans;
int b[MAX], sum[MAX], sum1[MAX], sum2[MAX];
long long a[MAX];
long long read() {
  long long x(0);
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    ;
  for (; isdigit(ch); x = x * 10 + ch - 48, ch = getchar())
    ;
  return x;
}
int ss(long long x) {
  int num = 0;
  while (x) {
    if (x & 1) ++num;
    x >>= 1;
  }
  return num;
}
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) a[i] = read(), b[i] = ss(a[i]);
  sum2[0] = 1;
  for (int i = 1; i <= n; ++i) {
    sum[i] = sum[i - 1] + b[i], sum1[i] = sum1[i - 1], sum2[i] = sum2[i - 1];
    if (sum[i] & 1)
      ++sum1[i];
    else
      ++sum2[i];
  }
  for (int i = 2; i <= n; ++i) {
    int maxn = 0, fl = 0;
    for (int j = i; j >= max(1, i - 61); --j) {
      maxn = max(maxn, b[j]);
      if (maxn <= (sum[i] - sum[j - 1]) / 2 && (sum[i] - sum[j - 1]) % 2 == 0)
        ++ans;
    }
    if (i - 62 > 1)
      if (sum[i] & 1)
        ans += sum1[i - 62];
      else
        ans += sum2[i - 62];
  }
  return cout << ans, 0;
}
