#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> v;
  int MOD = 1000000007;
  long long ans = 0;
  for (size_t i = 0; i < N; i++) {
    long long tmp;
    cin >> tmp;
    v.push_back(tmp);
  }
  for (size_t i = 0; i < v.size() - 1; i++) {
    for (size_t j = i + 1; j < v.size(); j++) {
      ans += (v[i] ^ v[j]);
      ans %= MOD;
    }
  }
  cout << ans;
}
