#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long a[n + 1];
  for (int i = 1; i <= (long long)(n); i++) cin >> a[i];
  double count = 0;
  for (int i = 1; i <= (long long)(n - 1); i++) {
    for (int j = i + 1; j <= n; j++) {
      count += (a[i] ^ a[j]);
    }
  }
  cout << (long long)fmod(count, (pow(10, 9) + 7)) << endl;
  return 0;
}
