#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
const int MOD = 1000000007;
void solve() {
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < (n); ++i) cin >> v[i];
  long long ans = 0;
  for (int i = 0; i < (n - 1); ++i) {
    for (int j = i + 1; j < n; j++) {
      ans += (v[i] ^ v[j]);
      ans %= MOD;
    }
  }
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
