#include <bits/stdc++.h>
int main() {
  using namespace std;
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  constexpr int Mod = 100000009;
  int N;
  cin >> N;
  vector<long long> A(N);
  for (auto& e : A) cin >> e;
  int ans = 0;
  for (int i = 0; i < 60; ++i) {
    array<long long, 2> count = {};
    for (const auto& e : A) ++count[(e >> i) & 1];
    cerr << count[0] << ' ' << count[1] << '\n';
    ans += count[0] * count[1] % Mod * ((1LL << i) % Mod) % Mod;
    if (ans > Mod) ans -= Mod;
  }
  cout << ans << endl;
}
