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