#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int main() {
  int N;
  long long int result = 0;
  cin >> N;
  long long int INF = 1e9 + 7;
  long long int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      result = (result + (A[i] ^ A[j])) % INF;
    }
  }
  cout << result << endl;
}
