#include <bits/stdc++.h>
const double E = 1e-8;
const double PI = acos(-1);
const long long MOD = 1e9 + 7;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  long long sum = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      sum = (sum + (v[i] ^ v[j])) % MOD;
    }
  }
  cout << sum << '\n';
  return 0;
}
