#include <bits/stdc++.h>
#pragma GCC optimize("-Ofast")
using namespace std;
long long power(long long x, unsigned long long y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return (power(x, y / 2) * power(x, y / 2));
  else
    return (x * power(x, y / 2) * power(x, y / 2));
}
bool comp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first == b.first) {
    return a.second > b.second;
  }
  return a.first > b.first;
}
int32_t main() {
  iostream::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long maxz, counter = 0;
  cin >> maxz;
  long long arr[maxz];
  for (long long i = 0; i < maxz; i++) {
    cin >> arr[i];
  }
  for (long long i = 0; i < maxz - 1; i++) {
    for (long long l = i + 1; l < maxz; l++) {
      counter = counter + (arr[i] ^ arr[l]) % 1000000007;
    }
  }
  cout << counter % 1000000007;
  return 0;
}
