#include <bits/stdc++.h>
using namespace std;
const long long MAXN = (long long)((1e5) + 10);
long long mult(long long a, long long b, long long p) {
  return ((a % p) * (b % p)) % p;
}
long long add(long long a, long long b, long long p) {
  return (a % p + b % p) % p;
}
long long fpow(long long n, long long k, long long p) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
bool isPrime(long long N) {
  for (long long i = 2; i * i <= N; ++i) {
    if (N % i == 0) return false;
  }
  return true;
}
long long cbrt(long long x) {
  long long lo = 1, hi = min(2000000LL, x);
  while (hi - lo > 1) {
    long long mid = (lo + hi) / 2;
    if (mid * mid * mid < x) {
      lo = mid;
    } else
      hi = mid;
  }
  if (hi * hi * hi <= x)
    return hi;
  else
    return lo;
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n];
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      a[i] = __builtin_popcountll(a[i]);
    }
    long long pre[n];
    for (long long i = 0; i < n; i++) {
      pre[i] = a[i];
      if (i != 0) {
        pre[i] += pre[i - 1];
      }
    }
    long long odd, even;
    auto combo = [&](long long val) { return (long long)val * (val - 1) / 2; };
    odd = 0;
    for (long long i = 0; i < n; i++) {
      if (pre[i] & 1) odd++;
    }
    even = n - odd;
    even++;
    long long answer = combo(odd) + combo(even);
    for (long long i = 0; i < n; i++) {
      long long s = 0;
      long long maxi = 0;
      for (long long j = i; j < min(n, i + 64); j++) {
        s += a[j];
        maxi = max(a[j], maxi);
        if (s % 2 == 0 && 2 * maxi > s) answer--;
      }
    }
    cout << answer << "\n";
  }
  return 0;
}
