#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int a[N], suff[N], c[N], nc[N];
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long c;
    cin >> c;
    int j = 0;
    while ((1LL << j) <= c) {
      if (c & (1LL << j)) {
        a[i]++;
      }
      j++;
    }
  }
  int cur = 0;
  c[n + 1] = 1;
  for (int i = n; i > 0; i--) {
    c[i] = c[i + 1];
    nc[i] = nc[i + 1];
    cur += a[i];
    if (cur & 1) {
      nc[i]++;
    } else {
      c[i]++;
    }
    suff[i] = cur;
  }
  long long ans = 0;
  for (int l = 1; l < n; l++) {
    if (suff[l] & 1) {
      ans += nc[l + 2];
    } else {
      ans += c[l + 2];
    }
    cur = a[l];
    int max1 = a[l];
    for (int r = l + 1; r <= min(l + 61, n); r++) {
      cur += a[r];
      max1 = max(max1, a[r]);
      if (!(cur & 1) && max1 * 2 > cur) {
        ans--;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
