#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  vector<long long> v;
  long long mod = (long long)1e9 + 7;
  long long m = n;
  while (m--) {
    long long k;
    cin >> k;
    v.push_back(k);
  }
  long long i = 0, j = 1;
  long long sum = 0;
  for (i = 0; i <= v.size() - 2; i++) {
    for (j = i + 1; j <= v.size() - 1; j++) {
      sum = ((sum % mod) + ((v[i] ^ v[j]) % mod)) % mod;
    }
  }
  cout << sum << endl;
}
