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