#include <bits/stdc++.h>
using namespace std;
long long binary(long bina) {
  long long ans = 0;
  for (long i = 0; bina > 0; i++) {
    ans = ans + (bina % 2) * pow(10, i);
    bina = bina / 2;
  }
  return ans;
}
long long bdd(long long a) {
  long weight = 1;
  long total = 0;
  while (a != 0) {
    total += (a % 10) * weight;
    a /= 10;
    weight *= 2;
  }
  return total;
}
int main() {
  int N;
  long sum = 0;
  cin >> N;
  vector<long> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
    vec.at(i) = binary(vec.at(i));
  }
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      long A = 0;
      long long S = vec.at(i) + vec.at(j);
      for (int k = 0; S > 0; k++) {
        if (S % 10 == 1) A += pow(10, k);
        S /= 10;
      }
      sum += bdd(A);
    }
  }
  cout << sum << endl;
}
