#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  long long Asum, Atemp;
  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++) {
      Atemp = (A[i] ^ A[j]);
      Atemp %= MOD;
      Asum += Atemp;
      Asum %= MOD;
    }
  }
  cout << Asum << endl;
}
