#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long MOD = 1e9 + 7;
int n;
vector<long long> a(300300, 0);
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a.at(i);
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      ans += (a.at(i) ^ a.at(j));
      ans %= MOD;
    }
  }
  cout << ans << endl;
}
