#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b, long long m = 1000000007) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long res = power(a, b / 2, m);
  res = (res * res) % m;
  if (b & 1) res = (res * a) % m;
  return res;
}
long long modinv(long long a, long long m = 1000000007) {
  return power(a, m - 2, m);
}
long long add(long long a, long long b, long long m = 1000000007) {
  long long c = (a % m + b % m);
  if (c >= m) c -= m;
  return c;
}
long long sub(long long a, long long b, long long m = 1000000007) {
  long long c = (a % m - b % m);
  if (c < 0) c += m;
  return c;
}
long long mul(long long a, long long b, long long m = 1000000007) {
  return (a * b) % m;
}
void solve() {
  long long n, i, ans = 0;
  cin >> n;
  long long a[n], p[n + 1], c[2][n + 1];
  p[0] = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    a[i] = __builtin_popcountll(a[i]);
    p[i + 1] = p[i] + a[i];
  }
  memset(c, 0, sizeof(c));
  for (i = n; i > 0; i--) {
    c[p[i] % 2][i]++;
    if (i != n) {
      c[0][i] += c[0][i + 1];
      c[1][i] += c[1][i + 1];
    }
  }
  for (i = 0; i < n; i++) {
    long long val = p[i + 1] + a[i];
    long long j = lower_bound(p, p + n + 1, val) - p;
    if (j <= n && j == i + 2) {
      ans += (a[i] == a[j - 1]);
      j++;
    }
    if (j == n + 1) break;
    ans += c[p[i] % 2][j];
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
