#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
struct edge {
  ll x, y;
};
struct huga {
  ll honest;
  bool done;
};
int main() {
  int n;
  cin >> n;
  ll a[n];
  for (int i = 0; i < n; i++) {
    ll temp;
    cin >> temp;
    a[i] = temp;
  }
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      ll temp = a[i] ^ a[j];
      ans += temp;
      ans %= mod;
    }
  }
  cout << ans << endl;
}
