#include <bits/stdc++.h>
using namespace std;
unsigned long long mod = 1000000007;
int main(int argc, const char* argv[]) {
  int n;
  cin >> n;
  unsigned long long ans = 0;
  vector<unsigned long long> a(n);
  for (int i = (0); i < (n); ++i) {
    cin >> a[i];
  }
  for (int i = (0); i < (n - 1); ++i) {
    for (int j = (i + 1); j < (n); ++j) {
      ans = (ans + (a[i] ^ a[j])) % mod;
    }
  }
  cout << ans << endl;
  return 0;
}
