#include <bits/stdc++.h>
using namespace std;
int main() {
  const int MOD = 1000000007;
  long long N;
  cin >> N;
  vector<long long> a(N);
  for (long long i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  long long b = 0;
  for (long long i = 0; i < N - 1; i++) {
    for (long long j = i + 1; j < N; j++) {
      b += (a.at(i) ^ a.at(j)) % MOD;
    }
  }
  cout << b % MOD;
}
