#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
signed main() {
  ios_base::sync_with_stdio(0);
  long long TESTS = 1;
  while (TESTS--) {
    long long n;
    cin >> n;
    long long m[60] = {};
    for (long long i = 0; i < n; i++) {
      long long t;
      cin >> t;
      for (long long j = 0; j < 60; j++) {
        if (t & (1 << j)) {
          m[j]++;
        }
      }
    }
    long long ans = 0;
    for (long long i = 0; i < 60; i++) {
      ans += (1 << i) * (m[i]) * (n - m[i]);
    }
    cout << ans / 2;
  }
}
