#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j;
  long long int sum = 0;
  cin >> n;
  long long int a[n + 5];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    int x = 0, y = 0;
    long long int sum1 = 0;
    for (j = 0; j < n; j++) {
      if (a[j] % 2 == 0)
        x++;
      else
        y++;
      a[j] = a[j] / 2;
    }
    sum1 = x * y * (1 << i);
    sum = sum + sum1;
  }
  cout << sum << "\n";
}
