#include <bits/stdc++.h>
using namespace std;
long long int cons;
long long int check(long long int a) {
  if (a >= cons) a %= cons;
  return a;
}
long long int check2(long long int a) {
  a %= cons;
  if (a < 0) a += cons;
  return a;
}
long long int fast_check(long long int a) {
  if (a >= cons) a -= cons;
  return a;
}
long long int GCD(long long int a, long long int b) {
  while (a && b) {
    a = a % b;
    if (a != 0) b = b % a;
  }
  return a + b;
}
long long int exp(long long int a, long long int n) {
  long long int ans = 1;
  a = check(a);
  while (n) {
    if (n & 1) ans = check(ans * a);
    a = check(a * a);
    n = (n >> 1);
  }
  return ans;
}
void print_pair(pair<int, int> p) {
  cout << p.first << " " << p.second << endl;
}
long long int nc2(long long int a) { return (a * (a - 1)) / 2; }
const int N = 4e5;
long long int arr[N][2];
int sum[N];
int ones[N];
int count1(long long int first) {
  int coun = 0;
  while (first) {
    coun++;
    first = first & (first - 1);
  }
  return (coun);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cons = 1e9 + 7;
  int n;
  cin >> n;
  arr[0][0] = 1;
  long long int ans = 0;
  for (int i = 1; i <= n; i++) {
    long long int first;
    cin >> first;
    first = count1(first);
    sum[i] = sum[i - 1] + first;
    ones[i] = first;
    int cumu = sum[i] & 1;
    arr[i][cumu] = arr[i - 1][cumu] + 1;
    arr[i][1 - cumu] = arr[i - 1][1 - cumu];
    int k = 1;
    int maxy = ones[i];
    while (k < 130 && i - k >= 0) {
      int bit_sum = sum[i] - sum[i - k];
      if (bit_sum % 2 == 0 && maxy * 2 <= bit_sum) {
        ans++;
      }
      maxy = max(maxy, ones[i - k]);
      k++;
      if (bit_sum >= 130) break;
    }
    if (i - k >= 0) ans += arr[i - k][cumu];
  }
  cout << ans;
}
