#include <bits/stdc++.h>
using namespace std;
const int infinity = 2000000999 / 2;
const long long int inff = 4000000000000000999;
template <class T>
T get() {
  T a;
  cin >> a;
  return a;
}
template <class T, class U>
ostream& operator<<(ostream& out, const pair<T, U>& par) {
  out << "[" << par.first << ";" << par.second << "]";
  return out;
}
template <class T>
ostream& operator<<(ostream& out, const set<T>& cont) {
  out << "{";
  for (const auto& x : cont) out << x << ", ";
  out << "}";
  return out;
}
template <class T, class U>
ostream& operator<<(ostream& out, const map<T, U>& cont) {
  out << "{";
  for (const auto& x : cont) out << x << ", ";
  out << "}";
  return out;
}
template <class T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i) out << " ";
    out << v[i];
  }
  out << endl;
  return out;
}
bool ccw(complex<long double> p, complex<long double> a,
         complex<long double> b) {
  if ((conj(a - p) * (b - p)).imag() <= 0)
    return false;
  else
    return true;
}
int main() {
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  int n = get<int>();
  vector<int> ones;
  for (int i = 0; i < (int)n; i++) {
    long long int a = get<long long int>();
    int cnt = 0;
    for (int j = 0; j < (int)60; j++) {
      if (a & (1LL << j)) cnt++;
    }
    ones.push_back(cnt);
  }
  long long int num = 0;
  if (0) cout << "ones: " << ones;
  vector<int> pfs(n + 1, 0);
  int odd = 0, even = 1, cur = 0;
  for (int i = 0; i < (int)n; i++) {
    cur += ones[i];
    if (0)
      cout << i << "th cur = " << cur << " odd " << odd << " even " << even
           << endl;
    if (cur % 2)
      num += odd;
    else
      num += even;
    if (cur % 2)
      odd++;
    else
      even++;
    pfs[i + 1] = cur;
  }
  if (0) cout << "PArnych " << num << endl;
  for (int i = 0; i < (int)n; i++) {
    int suma = 0;
    int maxi = 0;
    for (int j = i; j >= 0 && i - j < 124; j--) {
      suma += ones[j];
      maxi = max(maxi, ones[j]);
      if (0)
        cout << "[" << j << ", " << i << "] sum  " << suma << " maxi " << maxi
             << endl;
      if (suma % 2 == 0 && maxi * 2 > suma) {
        if (0) cout << "- [" << j << "; " << i << "]" << endl;
        num--;
      }
    }
  }
  cout << num << endl;
}
