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