#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long A[N + 1];
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  long long ans;
  for (int i = 1; i <= N - 1; i++) {
    for (int j = i + 1; j <= N; j++) {
      ans +=
          ((A[i] ^ A[j]) % (7 + (10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10)));
    }
  }
  ans %= (7 + (10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10));
  cout << ans;
}
