#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(x,y) for(ll i=x;i<y;i++)
#define tc ll t;cin>>t;while(t--)
#define vll vector<ll>
#define p_b push_back
#define sll set<ll>
int main() {
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
ll n;
cin>>n;
ll a[n];
ll sum=0;
rep(0,n)
cin>>a[i];
for(ll i=0;i<n-1;i++)
for(ll j=i+1;j<n;j++)
{
  ll x=(a[i] ^ a[j])mod 1000000009;
  sum=sum+x;
}
cout<<sum<<endl;
return 0;
}