#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const double eps = 1e-10;
const int MAX = 200000;
int main() {
  int n;
  cin >> n;
  vector<long long> av;
  long long k;
  for (int i = 0; i < n; i++) {
    cin >> k;
    av.push_back(k);
  }
  long long sum = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      sum = sum + (av[i] ^ av[j]) % mod;
      sum %= mod;
    }
  }
  cout << sum << endl;
  return 0;
}
