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