#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N;
vector<ll> a;
int main(int argc, char const *argv[]) {
  cin >> N;
  a.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  ll sum(0);
  for (int i = 0; i < (N - 1); i++) {
    ll l = a.at(i);
    for (int j = i + 1; j < N; j++) {
      ll r = a.at(j);
      sum += (l ^ r);
    }
  }
  cout << sum % (1000000000 + 7) << endl;
  return 0;
}
