#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using pi = pair<int, int>;
using ll = long long int;
template <typename T1, typename T2, typename T3>
T1 modpow(T1 _a, T2 p, T3 mod) {
  assert(p >= 0);
  ll ret = 1, a = _a;
  if (a < 0) {
    a %= mod;
    a += mod;
  }
  if (a >= mod) {
    a %= mod;
  }
  for (; p > 0; p /= 2) {
    if (p & 1) ret = ret * a % mod;
    a = a * a % mod;
  }
  return ret;
}
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr auto PI = 3.14159265358979323846L;
constexpr auto oo = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr int mx_n = 300005;
int n, cnt[mx_n];
ll a[mx_n];
int acnt[2];
int csum[mx_n];
int main() {
  cin >> n;
  for (int i = ((0)), _i = ((n)-1); i <= _i; ++i) cin >> a[i];
  for (int i = ((0)), _i = ((2) - 1); i <= _i; ++i) acnt[i] = 0;
  ll ans = 0;
  for (int i = ((0)), _i = ((n)-1); i <= _i; ++i) {
    cnt[i] = __builtin_popcountll(a[i]);
    csum[i] = (i == 0 ? 0 : csum[i - 1]) + cnt[i];
    int maxSofar = 0;
    for (int j = i; i - j < 200 && j >= 0; --j) {
      maxSofar = max(maxSofar, cnt[j]);
      int sum = csum[i] - (j == 0 ? 0 : csum[j - 1]);
      ;
      if (sum % 2 == 0 && 2 * maxSofar <= sum) ++ans;
    };
    int pi = i - 200;
    if (pi > 0)
      ++acnt[csum[pi - 1] & 1];
    else if (pi == 0)
      ++acnt[0];
    ans += acnt[csum[i] & 1];
  }
  cout << ans << endl;
  return 0;
}
