#include <bits/stdc++.h>
using namespace std;
int n, a[300005], s[300005], od[2], mx;
long long x, ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    for (; x; x >>= 1) a[i] += (x & 1);
  }
  for (int i = 1, j = 0; i <= n; i++) {
    s[i] = s[i - 1] + a[i];
    mx = 0;
    for (int k = i; k && k > i - 130; k--) {
      mx = max(mx, a[k]);
      if ((s[i] - s[k - 1]) % 2 == 0 && mx * 2 <= s[i] - s[k - 1]) ans++;
    }
    if (i > 130) {
      od[s[j] & 1]++;
      ans += od[s[i] & 1];
      j++;
    }
  }
  cout << ans;
}
