#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<ll> hoge(n);
  for (int i = 0; i < (n); ++i) {
    cin >> hoge[i];
  }
  ll sum = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int v = i + 1; v < n; v++) {
      sum += hoge[i] ^ hoge[v];
    }
  }
  cout << sum % (ll(1e9) + (ll)7) << endl;
}
