#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
string char_to_string(char val) { return string(1, val); }
int char_to_int(char val) { return val - '0'; }
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
struct edge {
  ll to, cost;
};
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0, i_len = (N); i < i_len; ++i) cin >> A[i];
  const int MOD = pow(10, 9) + 7;
  ll ans = 0;
  for (int i = 0, i_len = (N - 1); i < i_len; ++i) {
    for (int k = i + 1; k < N; ++k) {
      ans += (A[i] ^ A[k]);
      ans %= MOD;
    }
  }
  cout << ans << endl;
}
