#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<long long> A(n);
  long long res = 0;
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      res += A[i] ^ A[j];
      res %= 1000000007;
    }
  }
  cout << res;
}
