#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
long long res = 0;
long long st = 1;
const long long mod = 1000000009;
void Step(int n) {
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cnt += (v[i] % 2);
    v[i] /= 2;
  }
  res = res + (st * (cnt * (n - cnt))) % mod;
  res %= mod;
  st *= 2;
}
int main() {
  int n;
  cin >> n;
  long long val = 0;
  for (int i = 0; i < n; i++) {
    long long k;
    cin >> k;
    v.push_back(k);
    val = max(val, k);
  }
  for (; val > 0; val /= 2) Step(n);
  cout << res;
}
