#include <bits/stdc++.h>
using namespace std;
long long int my_binary_search(long long int ary[], long long int key,
                               long long int left, long long int right) {
  long long int middle;
  if (right < left) {
    return -((long long)(1e18 + 1));
  } else {
    middle = left + (right - left) / 2;
    if (ary[middle] > key) {
      return my_binary_search(ary, key, left, middle - 1);
    } else if (ary[middle] < key) {
      return my_binary_search(ary, key, middle + 1, right);
    } else {
      return middle;
    }
  }
}
struct UnionFind {
  vector<int> par;
  UnionFind(int N) : par(N) {
    for (int i = 0; i < N; i++) par[i] = i;
  }
  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    par[rx] = ry;
  }
  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};
int main(void) {
  long long int N, M;
  cin >> N;
  vector<long long int> A(N);
  for (int(i) = int(0); (i) < int(N); (i)++) {
    cin >> A[i];
  }
  long long int ans = 0;
  for (long long int i = 0; i < N - 1; i++) {
    for (long long int j = i + 1; j < N; j++) {
      ans += (A[i] ^ A[j]) % (1000000000 + 7);
    }
  }
  cout << ans << endl;
  return 0;
}
