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