#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 7;
int b[N], cnt[N][2], pre[N];
long long n;
void fio(long long &num) {
  bool neg = 0;
  num = 0;
  register int c;
  c = getchar();
  if (c == '-') neg = 1, c = getchar();
  for (; 47 < c && c < 58; c = getchar()) num = num * 10 + c - '0';
  if (neg) num *= -1;
}
int main() {
  fio(n);
  for (int i = 1; i <= n; i++) {
    long long x;
    fio(x);
    b[i] = __builtin_popcountll(x);
  }
  cnt[1][0] = 1 - b[1] % 2;
  cnt[1][1] = b[1] % 2;
  pre[1] = b[1];
  for (int i = 2; i <= n; i++) {
    if (b[i] % 2)
      cnt[i][0] = cnt[i - 1][1], cnt[i][1] = cnt[i - 1][0] + 1;
    else
      cnt[i][0] = cnt[i - 1][0] + 1, cnt[i][1] = cnt[i - 1][1];
    pre[i] = pre[i - 1] + b[i];
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int mx = 0, tmp = 0;
    for (int j = i; j >= max(1, i - 61); j--) {
      mx = max(mx, b[j]);
      int sum = pre[i] - pre[j - 1] - mx;
      if ((sum + mx) % 2 == 0) {
        tmp++;
        ans += (sum >= mx);
      }
    }
    ans += (1LL * cnt[i][0] - tmp);
  }
  cout << ans;
}
