#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  long long n;
  cin >> n;
  vector<long long> A(n);
  for (int i = 0; i < n; i++) cin >> A[i];
  long long ans = 0;
  for (int j = 0; j < n; j++)
    for (int i = 0; i < j; i++) {
      long long cnt = 0;
      for (int k = 0; k < 60; k++) {
        int x = A[i] >> k & 1;
        int y = A[j] >> k & 1;
        if (x == y) continue;
        cnt += (long long)pow(2, k) % mod;
      }
      ans += cnt;
    }
  cout << ans << endl;
  return 0;
}
