#include <bits/stdc++.h>
using namespace std;
long long arr[300001];
int main() {
  long long n;
  cin >> n;
  long long suma = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (long long i = 0; i < n; ++i) {
    for (long long j = i + 1; j < n; ++j) {
      suma += ((arr[i] ^ arr[j]) % (1000000000 + 7));
    }
  }
  cout << suma % (1000000000 + 7);
}
