#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll, ll>>>;
int main() {
  int N;
  cin >> N;
  ll A[N + 1];
  for (ll i = 1; i < (ll)(N + 1); i++) {
    cin >> A[i];
  }
  ll ans = 0;
  for (ll i = 1; i < (ll)(N - 1 + 1); i++) {
    for (ll j = (i + 1); j < (ll)(N + 1); j++) {
      ans += A[i] ^ A[j];
      ans %= 1000000007;
      ;
    }
  }
  cout << ans << endl;
  return 0;
}
