#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 36;
const long long M = 3e2 + 36;
const long long INF = 2e9 + 7;
const long long MOD = 987654323;
const long long MOD1 = 1e9 + 7;
const long long MOD2 = 1e9 + 9;
const long long KX[4] = {0, 0, 1, -1};
const long long KY[4] = {1, -1, 0, 0};
const long long X[8] = {1, 1, -1, -1, 2, 2, -2, -2};
const long long Y[8] = {2, -2, 2, -2, 1, -1, 1, -1};
int a[N];
int pref[N], calc[N][2];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i(0); i < n; ++i) {
    long long x;
    cin >> x;
    a[i] = __builtin_popcountll(x);
  }
  long long ans = 0;
  for (int i(0); i < n; ++i) {
    pref[i] = (pref[max(i - 1, 0)] + a[i]) % 2;
    calc[i][0] = calc[max(i - 1, 0)][0];
    calc[i][1] = calc[max(i - 1, 0)][1];
    calc[i][pref[i]]++;
  }
  int K = 60;
  for (int i(0); i < n; i++) {
    int mx = a[i], sum = 0;
    for (int j(i); j < min(i + K, n); j++) {
      sum += a[j];
      mx = max(mx, a[j]);
      if (sum % 2 == 0 && mx * 2 <= sum) ans++;
    }
    if (i + K < n) {
      if (i == 0 || pref[i - 1] == 0) {
        ans += calc[n - 1][0] - calc[i + K - 1][0];
      } else {
        ans += calc[n - 1][1] - calc[i + K - 1][1];
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
