#include <bits/stdc++.h>
using namespace std;
using P = pair<long long, long long>;
void solve_abc_d() {
  long long N;
  long long ans = 0;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < (long long)(N); i++) {
    cin >> A[i];
  }
  long long sum = 0;
  for (long long i = 0; i < (long long)(N); i++) {
    for (long long j = i + 1; j < (long long)(N); j++) {
      sum = (sum + (A[i] ^ A[j])) % 1000000007;
    }
  }
  cout << sum << "\n";
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve_abc_d();
  return 0;
}
