#include <bits/stdc++.h>
using namespace std;
char buf[1 << 21], *p1 = buf, *p2 = buf;
template <class T>
inline bool cmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
inline long long read() {
  char ch;
  bool flag = 0;
  long long res;
  while (!isdigit(
      ch = (p1 == p2 &&
                    (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
                ? EOF
                : *p1++)))
    (ch == '-') && (flag = true);
  for (res = ch - '0'; isdigit(
           ch = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin),
                             p1 == p2)
                     ? EOF
                     : *p1++));
       res = res * 10 + ch - '0')
    ;
  (flag) && (res = -res);
  return res;
}
const int N = 3e5 + 5;
int c[N], sum[N], cnt[2] = {1}, n;
long long ans;
inline int calc() {
  long long x = read();
  int res = 0;
  while (x) ++res, x -= x & -x;
  return res;
}
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) {
    c[i] = calc(), sum[i] = sum[i - 1] + c[i];
    ans += cnt[sum[i] & 1];
    for (int j = i, k = i + 1, mx = 0; j >= 1 && j >= i - 64; --j) {
      while (k > j) cmax(mx, c[--k]);
      if (mx * 2 > sum[i] - sum[j - 1] && ((sum[i] & 1) == (sum[j - 1] & 1)))
        --ans;
    }
    ++cnt[sum[i] & 1];
  }
  printf("%lld\n", ans);
  return 0;
}
