#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long int arr[n], sum = 0;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      sum += (arr[i]) ^ (arr[j]);
    }
  }
  long int result = sum % 1000000007;
  cout << result << endl;
}
