#include <bits/stdc++.h>
using namespace std;
void solve();
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
}
long long get(long long val) {
  long long res = 0;
  for (long long(i) = 0; (i) < (60); ++(i)) {
    if ((val >> i) & 1) res++;
  }
  return res;
}
long long cnt2[2];
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long(i) = 0; (i) < (n); ++(i)) cin >> a[i];
  vector<long long> b(n);
  for (long long(i) = 0; (i) < (n); ++(i)) b[i] = get(a[i]);
  long long res = 0;
  long long cnt = 0;
  long long sm2 = 0;
  cnt2[0]++;
  for (long long i = 0; i < n; ++i) {
    sm2 = (sm2 + b[i]) % 2;
    res += cnt2[1 - sm2];
    cnt2[sm2]++;
  };
  for (long long l = 0; l < n; ++l) {
    long long s = 0, mx = 0;
    cnt += n - l;
    for (long long r = l; r < n && r < l + 60; ++r) {
      s += b[r];
      mx = max(mx, b[r]);
      if (mx * 2 > s && s % 2 == 0) ++res;
    }
  }
  cout << cnt - res << '\n';
}
