#include <bits/stdc++.h>
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pl = pair<long long, long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const ll MOD = 1000000009;
vecl res1(60), res0(60);
ll modpow(ll a, ll n) {
  ll ans = 1;
  for (int i = 0; i < (n); ++i) {
    ans *= a;
    ans %= MOD;
  }
  return ans;
}
void ni(ll N) {
  string T = "";
  while (N > 0) {
    T += to_string(N % 2);
    N /= 2;
  }
  for (int i = 0; i < (60); ++i) {
    if (i < T.size()) {
      if (T[i] == '0')
        res0[i]++;
      else
        res1[i]++;
    } else
      res0[i]++;
  }
}
int main() {
  int N;
  cin >> N;
  vecl A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  ll ans = 0;
  for (int i = 0; i < (N); ++i) ni(A[i]);
  for (int i = 0; i < (60); ++i) {
    ll a = res0[i] * res1[i];
    a %= MOD;
    ll b = modpow(2, i);
    ans += a * b;
    ans %= MOD;
  }
  cout << ans << endl;
}
