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