#include <bits/stdc++.h>
using namespace std;
int n, x;
int c[61];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    for (int j = 0; j < 60; j++)
      if (x & (1 << j)) c[j]++;
  }
  long long res = 0;
  for (int i = 0; i < 60; i++) res += (long long)(n - c[i]) * c[i] * (1 << i);
  cout << res / 2 << endl;
  return 0;
}
