#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1000000000 + 7;
int main() {
  int N;
  cin >> N;
  vector<long long int> A(N);
  for (int i = 0; i < N; ++i) {
    scanf("%lld", &A[i]);
  }
  long long int s = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      s += (A[i] ^ A[j]) % MOD;
      s = s % MOD;
    }
  }
  cout << s;
}
