#include <bits/stdc++.h>
using namespace std;
template <class T>
void splitstr(const string &s, vector<T> &out) {
  istringstream in(s);
  out.clear();
  copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out));
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
static void redirect(int argc, const char **argv) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (argc > 1) {
    static filebuf f;
    f.open(argv[1], ios::in);
    cin.rdbuf(&f);
    if (!cin) {
      cerr << "Failed to open '" << argv[1] << "'" << endl;
      exit(1);
    }
  }
  if (argc > 2) {
    static filebuf f;
    f.open(argv[2], ios::out | ios::trunc);
    cout.rdbuf(&f);
    if (!cout) {
      cerr << "Failed to open '" << argv[2] << "'" << endl;
    }
  }
}
int main(int argc, const char **argv) {
  redirect(argc, argv);
  int N;
  cin >> N;
  vector<unsigned char> bits(N);
  vector<pair<int, int> > tbits[2];
  int cur = 0;
  tbits[0].emplace_back(0, 0);
  for (int i = 0; i < N; i++) {
    long long a;
    cin >> a;
    int b = __builtin_popcountll(a);
    bits[i] = b;
    cur += b;
    tbits[cur & 1].emplace_back(i + 1, cur);
  }
  long long ans = 0;
  for (int side = 0; side < 2; side++) {
    const auto &tb = tbits[side];
    for (int i = 0; i < ((long long)(tb).size()) - 1; i++) {
      int mx = 0;
      int bad = 0;
      auto tbi = tb[i];
      for (int j = i + 1;
           j < ((long long)(tb).size()) && tb[j].first - tbi.first < 128; j++) {
        for (int k = tb[j - 1].first; k < tb[j].first; k++) {
          if (bits[k] > mx) mx = bits[k];
        }
        if (mx * 2 > tb[j].second - tbi.second) bad++;
      }
      ans += ((long long)(tb).size()) - 1 - i - bad;
    }
  }
  cout << ans << '\n';
  return 0;
}
