#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;
int main() {
  cin >> n;
  vector<long long> a(n, 0);
  map<long long, int> mp;
  for (int i = 0; i < n; ++i) {
    cin >> a.at(i);
    mp[a.at(i)]++;
  }
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  int alen = a.size();
  long long ans = 0;
  for (int i = 0; i < alen; ++i) {
    for (int j = i + 1; j < alen; ++j) {
      long long ina = (a.at(i) ^ a.at(j));
      ina *= mp[a.at(i)] * mp[a.at(j)];
      ans += ina;
      ans %= MOD;
    }
  }
  cout << ans << endl;
}
