#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<unsigned long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  unsigned long long sum = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      sum += (a[i] ^ a[j]);
      sum %= (unsigned long long)1e9 + 7;
    }
  }
  cout << sum << endl;
  return 0;
}
