#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  std::cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) std::cin >> a[i];
  int sum = 0;
  for (int x = 0; x <= n - 1; ++x) {
    for (int y = x + 1; y <= n - 1; ++y) {
      sum += a[x] ^ a[y];
    }
  }
  cout << sum % 1000000007 << endl;
}
