#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, sum = 0;
  cin >> n;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i < n - 1; i++) {
    for (long long int j = i; j < n; j++) {
      long long int t = a[i] ^ a[j];
      t %= 1000000009;
      sum += t;
      sum %= 1000000009;
    }
  }
  cout << sum;
  return 0;
}
