#include <bits/stdc++.h>
static const int MOD = 1000000007;
static const long long INF = 1000000000000000000LL;
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  for (long long i = 0; i < (N); i++) {
    cin >> a[i];
  }
  long long res = 0;
  for (int i = 0; i < N - 1; ++i) {
    for (int j = i + 1; j < N; ++j) {
      res += a[i] ^ a[j];
      res %= MOD;
    }
  }
  cout << res << endl;
  return 0;
}
