#include <bits/stdc++.h>
using namespace std;
using ul = unsigned long;
using ll = long long;
ll mod = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<ll> A(N);
  ll a;
  for (int i = 0; i < N; ++i) {
    cin >> a;
    A[i] = a;
  }
  ll r = 0;
  for (int i = 0; i < N - 1; ++i) {
    for (int j = i + 1; j < N; ++j) {
      r += A[i] ^ A[j];
      r %= mod;
    }
  }
  cout << r << endl;
}
