#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long sum = 0;
  for (long long i = 1; i <= N - 1; i++) {
    for (long long j = i + 1; j <= N; j++) {
      sum += A[i - 1] ^ A[j - 1];
      sum %= (1000000000 + 7);
    }
  }
  cout << sum << endl;
}
