#include <bits/stdc++.h>
using namespace std;
static inline void canhazfast() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
template <typename T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
T extgcd(T a, T b, T &x, T &y) {
  T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
  while (b) {
    T q = a / b;
    a %= b;
    swap(a, b);
    x0 -= q * x1;
    swap(x0, x1);
    y0 -= q * y1;
    swap(y0, y1);
  }
  x = x0;
  y = y0;
  return a;
}
static inline int ctz(unsigned x) { return __builtin_ctz(x); }
static inline int ctzll(unsigned long long x) { return __builtin_ctzll(x); }
static inline int clz(unsigned x) { return __builtin_clz(x); }
static inline int clzll(unsigned long long x) { return __builtin_clzll(x); }
static inline int popcnt(unsigned x) { return __builtin_popcount(x); }
static inline int popcntll(unsigned long long x) {
  return __builtin_popcountll(x);
}
static inline int bsr(unsigned x) { return 31 ^ clz(x); }
static inline int bsrll(unsigned long long x) { return 63 ^ clzll(x); }
pair<int, int> comp(const pair<int, int> &x, const pair<int, int> &y) {
  pair<int, int> z;
  z.second = x.second + y.second;
  z.first = max(x.first, y.first) <= min(x.second, y.second)
                ? 0
                : min(abs(x.first - y.second), abs(y.first - x.second));
  return z;
}
int main() {
  canhazfast();
  static int c[300016], dp[300016][2];
  int n;
  const int cmx = 59;
  long long ans = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    long long a;
    cin >> a;
    c[i] = popcntll(a);
  }
  dp[0][0];
  for (int i = 0; i < n; ++i) {
    int s = 0, m = 0;
    for (int j = 0; j <= min(i, cmx); ++j) {
      s += c[i - j];
      m = max(m, c[i - j]);
      if (s >= 2 * m && s % 2 == 0) ++ans;
    }
    if (i > cmx) ans += dp[i - cmx][s % 2];
    int p = c[i] % 2;
    dp[i + 1][p] = dp[i][0] + 1;
    dp[i + 1][p ^ 1] = dp[i][1];
  }
  cout << ans;
  return 0;
}
