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