#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> v{istream_iterator<long long>(cin),
                      istream_iterator<long long>()};
  unsigned long long sum = 0;
  int count = 0;
  for (int i = 0; i < N - 1; ++i) {
    for (int j = i + 1; j < N; ++j) {
      sum = sum + (unsigned long long)(v[i] ^ v[j]) % (1000000000 + 7);
    }
  }
  cout << sum % (1000000000 + 7) << endl;
  return 0;
}
