#include <bits/stdc++.h>
using namespace std;
long long xorc(long long a, long long b) { return a ^ b; }
void solve() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  long long sum = 0;
  for (long long i = 0; i < N - 1; i++) {
    for (long long j = i + 1; j < N; j++) {
      sum += xorc(A.at(i), A.at(j));
      sum %= 1000000007;
    }
  }
  cout << sum << endl;
  return;
}
int main() {
  solve();
  return 0;
}
