#include <bits/stdc++.h>
using namespace std;
const int max_n = 300005;
int b[max_n];
long long x;
int sum[max_n];
int odd[max_n];
int even[max_n];
int n;
int work(long long x) {
  int res = 0;
  while (x) {
    x -= x & -x;
    res++;
  }
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &x);
    b[i] = work(x);
  }
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + b[i];
  for (int i = 1; i <= n; i++) {
    odd[i] = odd[i - 1];
    if (sum[i] % 2) odd[i]++;
    even[i] = i - odd[i];
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (sum[i - 1] % 2)
      ans += odd[n] - odd[i - 1];
    else
      ans += even[n] - even[i - 1];
  }
  int maxv;
  for (int i = 1; i <= n; i++) {
    maxv = -1;
    for (int j = 0; j <= 60; j++) {
      if (j + i > n) break;
      maxv = max(maxv, b[i + j]);
      if ((sum[j + i] - sum[i - 1]) % 2 == 0 &&
          maxv > sum[j + i] - sum[i - 1] - maxv)
        ans--;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
