#include <bits/stdc++.h>
using namespace std;
const long long M = 64;
long long a[400100];
long long Prefix[400100];
long long PreOdd[400100];
long long PreEven[400100];
long long PopCount(long long x) {
  long long Res = 0;
  for (long long i = 0; i < 64; i++) Res += ((x & (1LL << i)) != 0);
  return Res;
}
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    a[i] = PopCount(a[i]);
    Prefix[i] = a[i] + Prefix[i - 1];
    PreOdd[i] = (Prefix[i] & 1) + PreOdd[i - 1];
    PreEven[i] = !(Prefix[i] & 1) + PreEven[i - 1];
  }
  long long Answer = 0;
  for (long long i = 1; i <= n; i++) {
    long long Max = 0;
    long long Sum = 0;
    for (long long j = i; j <= n; j++) {
      Sum += a[j];
      Max = max(Max, a[j]);
      if (Sum - M >= M) {
        if (Prefix[i - 1] & 1)
          Answer += PreOdd[n] - PreOdd[j - 1];
        else
          Answer += PreEven[n] - PreEven[j - 1];
        break;
      }
      if (Sum - Max >= Max && (!(Sum & 1))) Answer++;
    }
  }
  cout << Answer;
}
