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