#include <bits/stdc++.h>
using namespace std;
long long int fff(long long int dizi[], long long int n) {
  long long int sum = 0;
  for (long long int i = 0; i < 64; i++) {
    long long int z = 0, o = 0;
    for (int j = 0; j < n; j++) {
      if (dizi[j] % 2 == 0)
        z++;
      else
        o++;
      dizi[j] /= 2;
    }
    sum += (1 << i) * z * o;
  }
  return sum;
}
long long int n;
int main() {
  cin >> n;
  long long int d[n];
  for (long long int i = 0; i < n; i++) cin >> d[i];
  cout << fff(d, n);
  return 0;
}
