#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getrnd(int l, int r) { return uniform_int_distribution<int>(l, r)(rng); }
template <typename T1, typename T2>
bool relax(T1& a, const T2& b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
bool strain(T1& a, const T2& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    ll x;
    cin >> x;
    while (x) {
      a[i] += x % 2;
      x /= 2;
    }
  }
  vector<int> sum(2, 0);
  int s = 0;
  sum[s] = 1;
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    s += a[i];
    ans += sum[s % 2];
    int mx = a[i], temp = a[i];
    for (int j = i - 1; j >= max(0, i - 64); --j) {
      if (2 * mx > temp && temp % 2 == 0) {
        --ans;
      }
      strain(mx, a[j]);
      temp += a[j];
    }
    if (2 * mx > temp && temp % 2 == 0) {
      --ans;
    }
    ++sum[s % 2];
  }
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  srand(time(0));
  int t = 1;
  while (t--) solve();
  return 0;
}
