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