#include <bits/stdc++.h>
using namespace std;
int a[(300010)], f[(800)], g[(800)], low[(300010)], high[(300010)];
int n;
int n1(long long x) {
  int res = 0;
  while (x) {
    res++;
    x -= x & -x;
  }
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    long long tmp;
    scanf("%I64d", &tmp);
    a[i] = n1(tmp);
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    int x = a[i];
    for (int l = max(1, i - (700)); l < i; ++l) {
      if (x < low[l]) {
        low[l] = abs(x - low[l]);
      } else if (x < high[l]) {
        low[l] = (x ^ low[l]) & 1;
      } else {
        low[l] = x - high[l];
      }
      high[l] = x + high[l];
    }
    low[i] = high[i] = x;
    if (i - (700) > 0) {
      for (int j = 0; j <= (700); ++j) {
        g[j] = 0;
      }
      for (int j = 0; j <= x; ++j) {
        g[(j ^ x) & 1] += f[j];
      }
      for (int j = x + 1; j <= (700); ++j) {
        g[j - x] += f[j];
      }
      g[low[i - (700)]]++;
      for (int j = 0; j <= (700); ++j) {
        f[j] = g[j];
      }
    }
    if (i - (700) > 0) {
      ans += f[0];
    }
    for (int j = max(1, i - (700) + 1); j <= i; ++j) {
      ans += low[j] == 0;
    }
  }
  printf("%I64d\n", ans);
}
