#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const int maxn = 300100;
const int max0 = 140;
int n;
int a[maxn + 5];
int val[maxn + 5];
int suma[maxn + 5];
int sum[2][maxn + 5];
int main() {
  scanf("%d", &n);
  for (int i = (0), i_end_ = (n); i < i_end_; ++i) {
    long long first;
    scanf(
        "%"
        "ll"
        "d",
        &first);
    a[i] = __builtin_popcountll(first);
  }
  sum[0][0] = 0;
  sum[1][0] = 0;
  for (int i = (0), i_end_ = (n); i < i_end_; ++i) {
    sum[0][i + 1] = sum[0][i] + !(suma[i] & 1);
    sum[1][i + 1] = sum[1][i] + (suma[i] & 1);
    suma[i + 1] = suma[i] + a[i];
    val[i] = suma[i] & 1;
  }
  val[n] = suma[n] & 1;
  long long ans = 0;
  for (int i = (0), i_end_ = (n); i < i_end_; ++i) {
    int Max = 0;
    int lim = max(0, i - max0);
    for (int j = i; j >= lim; --j) {
      chkmax(Max, a[j]);
      if (val[j] == val[i + 1] && suma[i + 1] - suma[j] >= Max * 2) {
        ++ans;
      }
    }
    ans += sum[val[i + 1]][lim];
  }
  cout << ans << endl;
  return 0;
}
