#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long sum = 0;
  long long n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = i; j < n; j++) {
      sum += a[i] ^ a[j];
    }
  }
  double result;
  result = fmod(double(sum), (pow(10, 7)));
  cout << result << endl;
}
