#include <bits/stdc++.h>
using namespace std;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL << 60;
void chmin(long long &a, long long b) {
  if (a > b) a = b;
}
void chmax(long long &a, long long b) {
  if (a < b) a = b;
}
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  unsigned long long N;
  cin >> N;
  unsigned long long A[300010];
  for (unsigned long long i = 0; i < (N); i++) cin >> A[i];
  unsigned long long sum = 0;
  for (unsigned long long i = 0; i < (N); i++) {
    for (unsigned long long j = i + 1; j < (N); j++) {
      sum += A[i] ^ A[j];
      sum %= mod;
    }
  }
  cout << sum << "\n";
  return 0;
}
