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