#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, tmp, ans = 0;
  cin >> N;
  tmp = 1e9 + 7;
  vector<long long> vec(N);
  for (long long i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  for (long long i = 0; i < N - 1; i++) {
    for (long long j = i + 1; j < N; j++) {
      ans += (vec.at(i) ^ vec.at(j)) % tmp;
    }
  }
  cout << ans % tmp << endl;
}
