#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (long long int i = 0; i < a.size(); i++) {
    cin >> a[i];
  }
  long long int sum = 0;
  for (long long int i = 0; i < a.size(); i++) {
    for (long long int j = i + 1; j < a.size(); j++) {
      if (a[i] == a[j]) {
        continue;
      }
      sum += ((a[i] ^ a[j]) % 1000000007);
    }
  }
  cout << sum % 1000000007 << endl;
  return 0;
}
