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