#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> vec;
  for (long long i = 0; i < N; i++) {
    long long a;
    cin >> a;
    vec.push_back(a);
  }
  long long cnt = 0;
  for (long long i = 0; i < N - 1; i++) {
    for (long long j = i + 1; j < N; j++) {
      cnt += vec[i] ^ vec[j];
      cnt = cnt % 1000000007;
    }
  }
  cout << cnt << endl;
  return 0;
}
