#include <bits/stdc++.h>
using namespace std;
const long long int r = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<long long int> a(n);
  for (auto &i : a) cin >> i;
  long long sum = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      sum += a[i] ^ a[j];
      sum %= r;
    }
  }
  cout << sum << "\n";
  return 0;
}
