#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long int *arr = new long long int[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  long long int sum{0};
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      sum += arr[i] ^ arr[j];
    }
  }
  cout << sum % (1000000000 + 7) << "\n";
  delete[] arr;
  return 0;
}
