#include <bits/stdc++.h>
using namespace std;
vector<int> getxV(long long x) {
  vector<int> v(60, 0);
  int i = 59;
  while (x > 0) {
    if (x % 2 == 1) v[i] = 1;
    x = x / 2;
    i--;
  }
  return v;
}
long long getN(vector<int> v) {
  long long n = 1;
  int i = 0;
  while (v[i] != 1) i++;
  i++;
  while (i < 60) {
    n *= 2;
    if (v[i] == 1) n += 1;
    i++;
  }
  return n;
}
vector<int> afterOperation(vector<int> sol) {
  int carry = 0;
  for (int i = 59; i >= 0; i--) {
    if (carry == 0) {
      if (sol[i] == 0 || sol[i] == 1)
        continue;
      else {
        carry = 1;
        if (sol[i] % 2 == 0)
          sol[i] = 0;
        else
          sol[i] = 1;
      }
    } else if (carry == 1) {
      sol[i] += 1;
      if (sol[i] == 1)
        carry = 0;
      else {
        if (sol[i] % 2 == 0)
          sol[i] = 0;
        else
          sol[i] = 1;
      }
    }
  }
  return sol;
}
int main() {
  int n;
  cin >> n;
  vector<vector<int>> v;
  while (n--) {
    long long x;
    cin >> x;
    v.push_back(getxV(x));
  }
  vector<int> sol(60, 0);
  for (int i = 59; i >= 0; i--) {
    int count = 0;
    for (int j = 0; j < v.size(); j++)
      if (v[j][i] == 1) count++;
    if (count % 2 == 1) sol[i]++;
    if (count != 0) sol[i - count]++;
  }
  sol = afterOperation(sol);
  cout << getN(sol) % 1000000009;
}
