#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 13;
const long long INF = 2e18;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n + 1), pref(n + 1), suff(n + 1);
  for (long long i = 1; i <= n; ++i) {
    long long x;
    cin >> x;
    while (x > 0) a[i] += x & 1, x >>= 1;
  }
  for (long long i = 1; i <= n; ++i) {
    pref[i] = pref[i - 1] + a[i];
  }
  suff[n] = pref[n] & 1;
  for (long long i = n - 1; i >= 1; --i) {
    suff[i] = suff[i + 1] + (pref[i] & 1);
  }
  long long ans = 0;
  for (long long l = 1; l <= n; ++l) {
    long long mx = a[l];
    for (long long r = l; r <= min(l + 64, n); ++r) {
      mx = max(mx, a[r]);
      long long sum = pref[r] - pref[l - 1];
      if ((sum & 1 ^ 1) && mx <= sum - mx) ans++;
    }
    if (l + 64 >= n) continue;
    if (pref[l - 1] & 1)
      ans += suff[l + 65];
    else
      ans += n - l - 64 - suff[l + 65];
  }
  cout << ans << "\n";
  return 0;
}
