#include <bits/stdc++.h>
using namespace std;
using lint = long long;
void debug_cerr() { cerr << '\n'; }
template <class Head, class... Tail>
void debug_cerr(Head head, Tail... tail) {
  cerr << ' ' << head;
  debug_cerr(tail...);
}
void chmax(lint &a, lint b) {
  if (a < b) a = b;
}
void chmin(lint &a, lint b) {
  if (a > b) a = b;
}
struct IoSetup {
  IoSetup() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(20);
  }
} iosetup;
const int mod = 1e9 + 7;
int main() {
  lint sum = 0;
  int n;
  cin >> n;
  vector<lint> vec(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> vec[i];
  }
  for (int i = 1; i < n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      sum += (vec[i] ^ vec[j]) % mod;
      sum %= mod;
    }
  }
  cout << sum << '\n';
}
