#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
ll M = 1000000007;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vl a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll ans = 0;
  for (ll i = 0; i < n - 1; i++) {
    ll tmp = 0;
    for (ll j = i + 1; j < n; j++) {
      tmp = (tmp + (a[i] ^ a[j]) % M) % M;
    }
    ans = (ans + tmp % M) % M;
  }
  cout << ans << endl;
  return 0;
}
