#include <bits/stdc++.h>
using namespace std;
const int mx = 2e5;
int main(void) {
  long long N;
  cin >> N;
  long long A[N];
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long ans = 0;
  for (long long i = 0; i < N - 1; i++) {
    for (long long j = i + 1; j < N; j++) {
      ans += A[i] ^ A[j];
      ans %= 1000000007;
    }
  }
  cout << ans;
  return 0;
}
