#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9 + 7;
const int vx[6] = {0, 1, 0, -1, 1, -1};
const int vy[6] = {1, 0, -1, 0, 1, 1};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (ll i = 0; i < n; ++i) {
    cin >> a[i];
  }
  ll ans = 0;
  for (ll i = 0; i < n - 1; ++i) {
    for (ll j = i; j < n; ++j) {
      ans += (a[i] ^ a[j]) % mod;
      ans %= mod;
    }
  }
  cout << ans << endl;
  cout << endl;
  return 0;
}
