#include <bits/stdc++.h>
const double PI = 3.1415926;
const int KL = 1e6;
using namespace std;
long long q, x, y, z, n, m, a[KL], mn = 1e9, mx = -1e9, ans;
string t;
vector<long long> vec[2];
set<int> s;
map<int, int> M;
int main() {
  scanf("%lld", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &x);
    while (x != 0) {
      if (x % 2 == 1) a[i + 1]++;
      x /= 2;
    }
    a[i + 1] += a[i];
  }
  vec[0].push_back(0);
  for (int i = 1; i <= n; i++) {
    mx = a[i] - a[i - 1];
    for (int j = i - 1; j >= max(0, i - 118); j--) {
      if ((a[i] - a[j]) % 2 == 0 && mx <= (a[i] - a[j]) / 2) ans++;
      mx = max(mx, a[j] - a[j - 1]);
    }
    int pos;
    if (a[i] % 2 == 0)
      pos = 0;
    else
      pos = 1;
    if (vec[pos].size() > 0) {
      if (vec[pos][0] < max(0, i - 118)) {
        long long lo = 0, hi = vec[pos].size() - 1;
        while (lo < hi) {
          long long mid = (lo + hi + 1) / 2;
          if (vec[pos][mid] < max(0, i - 118))
            lo = mid;
          else
            hi = mid - 1;
        }
        ans += (long long)(lo + 1);
      }
    }
    if (a[i] % 2 == 0)
      vec[0].push_back(i);
    else
      vec[1].push_back(i);
  }
  cout << ans << endl;
  return 0;
}
