#include <bits/stdc++.h>
using namespace std;
inline void scf(int &u) { scanf("%d", &u); }
inline void scf(long long &u) { scanf("%I64d", &u); }
inline void scf(unsigned long long &u) { scanf("%I64u", &u); }
inline void scf(double &u) { scanf("%lf", &u); }
inline void scf(char &u) { scanf("%c", &u); }
inline void scf(char *u) { scanf("%s", u); }
const int N = 3e5 + 7;
const int M = 64;
const int mars = 0x3c3c3c3c;
const long long marsll = 0x3c3c3c3c3c3c3c3cll;
typedef int Arr[N];
typedef char Err[N];
typedef bool Brr[N];
typedef long long Lrr[N];
int n, m, k, w, q, x, y, z, tot, cnt, l, r, t, u, a, b, c, d;
long long s;
Lrr A;
Arr C, D, O, E;
int Cnt[M + 3];
int main() {
  int i, k, t;
  E[0] = 1, scf(n);
  for (i = 1; i <= n; i++) scf(A[i]);
  for (i = 1; i <= n; i++) {
    C[i] = __builtin_popcountll(A[i]);
    D[i] = D[i - 1] + C[i];
    O[i] += O[i - 1], E[i] += E[i - 1];
    if (D[i] & 1)
      O[i]++;
    else
      E[i]++;
  }
  for (k = 1; k < 2 * M && k < n; k++) {
    memset(Cnt, 0, sizeof(Cnt)), l = 0;
    for (i = 1; i <= k; i++) Cnt[C[i]]++, l = max(l, C[i]);
    for (i = 1; i + k <= n; i++) {
      Cnt[C[i + k]]++, l = max(l, C[i + k]), t = D[i + k] - D[i - 1];
      if (!(t & 1) && l * 2 <= t) s++;
      Cnt[C[i]]--;
      while (!Cnt[l]) l--;
    }
  }
  for (i = 2 * M + 1; i <= n; i++)
    if (D[i] & 1)
      s += O[i - (2 * M + 1)];
    else
      s += E[i - (2 * M + 1)];
  cout << s;
}
