#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  ull sum = 0;
  cin >> N;
  ull b = 1000000007;
  vector<ull> v(N);
  for (ull i = 0; i < N; i++) cin >> v[i];
  sort(v.begin(), v.end());
  for (ull i = 0; i < N - 1; i++) {
    for (ull j = i + 1; j < N; j++) {
      sum += v[i] ^ v[j];
      sum %= b;
    }
  }
  cout << sum << endl;
  return 0;
}
