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