시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 531 193 130 40.248%

문제

상근이는 초등학교 졸업 여행으로 외계 행성 X3에 방문했었다. 이 행성에 사는 사람들의 이름은 모두 자연수이다. 행성의 거주민은 모두 서로를 알고 있다. 두 X3인은 그들의 친밀도를 자신의 이름을 이진수로 바꾸어서 계산한다. 두 이름을 이진수로 바꾸고, 자리수가 짧은 쪽을 기준으로 정렬한다. 이 때, 두 이진수의 각 자리 아래에 두 자리가 같으면 0을, 다르면 1을 적는다. 이 결과 이진수를 다시 10진수로 바꾸면 그들의 친밀도가 된다.

예를 들어, 10과 19의 친밀도는 25이다.

행성의 가치는 이 섬에 있는 모든 친밀도의 합이다. 행성 거주민들의 이름이 주어졌을 때, 행성의 가치를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 X3 거주민의 수 N이 주어진다. (1 ≤ N ≤ 1,000,000) 다음 N개의 줄에는 거주민의 이름이 주어진다. 이름은 1,000,000보다 작거나 같은 자연수이다.

출력

첫째 줄에 행성 X3의 가치를 출력한다.

예제 입력 1

3
7
3
5

예제 출력 1

12
W3sicHJvYmxlbV9pZCI6IjI4MzAiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQ1ODlcdWMxMzEgWDMiLCJkZXNjcmlwdGlvbiI6IjxwPlxyXG5cdFx1YzBjMVx1YWRmY1x1Yzc3NFx1YjI5NCBcdWNkMDhcdWI0ZjFcdWQ1NTlcdWFkNTAgXHVjODc4XHVjNWM1IFx1YzVlY1x1ZDU4OVx1YzczY1x1Yjg1YyBcdWM2NzhcdWFjYzQgXHVkNTg5XHVjMTMxIFgzXHVjNWQwIFx1YmMyOVx1YmIzOFx1ZDU4OFx1YzVjOFx1YjJlNC4gXHVjNzc0IFx1ZDU4OVx1YzEzMVx1YzVkMCBcdWMwYWNcdWIyOTQgXHVjMGFjXHViNzhjXHViNGU0XHVjNzU4IFx1Yzc3NFx1Yjk4NFx1Yzc0MCBcdWJhYThcd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