#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    ll x;
    cin >> x;
    int c = 0;
    while (x > 0) {
      c += x & 1;
      x >>= 1;
    }
    v[i] = c;
  }
  vector<int> dp(2, 0);
  dp[0] = 1;
  int pre = 0;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    int j = i - 1;
    int s = 0;
    int curpre = pre;
    vector<int> t(2, 0);
    while (j >= 0 && v[i] > s) {
      s += v[j];
      t[curpre & 1]++;
      curpre -= v[j];
      j--;
    }
    pre += v[i];
    if (v[i] <= s) {
      ans += dp[pre & 1] - t[pre & 1];
    }
    dp[pre & 1]++;
  }
  cout << ans;
  return 0;
}
