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