#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
void solve(void) {
  int N;
  cin >> N;
  vector<ll> A(N);
  ll ans = 0LL;
  for (int i = 0; i < (N); i++) {
    cin >> A[i];
  }
  for (int i = 0; i < (N - 1); i++) {
    for (int j = i + 1; j < (N); j++) {
      ans += A[i] ^ A[j];
      ans = ans % MOD;
    }
  }
  cout << ans << endl;
  return;
}
int main(int argc, const char* argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
