#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int main() {
  int n;
  cin >> n;
  vector<ull> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  ull ret = 0;
  ull c = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      ret += (a[i] ^ a[j]) % 1000000007ull;
    }
  }
  cout << ret;
  return 0;
}
