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