#include <bits/stdc++.h>
using namespace std;
long long n, ans = 0, a[300005], s[300005], b[300005][2];
inline long long read() {
  long long red = 0, f_f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f_f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') red = red * 10 + ch - '0', ch = getchar();
  return red * f_f;
}
long long count(long long x) {
  long long sum = 0;
  while (x) sum++, x -= x & -x;
  return sum;
}
long long work(long long x, long long y) {
  long long sum = 0;
  for (long long i = x; i <= y; i++) {
    for (long long j = i + 1; j <= y; j++) {
      long long mx = 0;
      for (long long l = i; l <= j; l++) mx = max(mx, a[l]);
      if (mx * 2 <= s[j] - s[i - 1] && (s[j] - s[i - 1]) % 2 == 0) sum++;
    }
  }
  return sum;
}
signed main() {
  n = read();
  b[0][0] = 1;
  for (long long i = 1; i <= n; i++)
    a[i] = count(read()), s[i] = s[i - 1] + a[i];
  for (long long i = 1; i <= n; i++)
    b[i][0] = b[i - 1][0], b[i][1] = b[i - 1][1], b[i][s[i] & 1]++;
  for (long long i = 1; i <= n; i++) {
    long long ed = max(1ll, i - 128ll), mx = a[i];
    for (long long j = i - 1; j >= ed; j--) {
      mx = max(mx, a[j]);
      if (mx * 2 <= s[i] - s[j - 1] && (s[i] - s[j - 1]) % 2 == 0) ans++;
    }
    if (i > 129) ans += b[i - 130][s[i] & 1];
  }
  printf("%lld\n", ans);
  return 0;
}
