#include <bits/stdc++.h>
using namespace std;
using ll = long long;
signed main() {
  int n;
  cin >> n;
  ll a[n];
  ll total = 0, ans;
  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) {
      total += a[i] ^ a[j];
    }
  ans = total % 1000000007;
  cout << ans;
  cout << "\n";
  return 0;
}
