#1048
Unrated
KOMPIĆI
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Author: Adrian Satja Kurdija

After successfully solving his math homework from the previous task, Mirko has become bored, so he has made a list of N large integers. On the list there are some pairs of numbers that he likes, and some pairs he doesn’t like. Mirko has named the pairs that he likes pals. Two numbers are pals if they have at least one digit in common (not necessarily in the same position). Help Mirko count how many pairs of numbers in his list are pals.

입력

The first line of input contains the positive integer N (1 ≤ N ≤ 1 000 000). Each of the next N lines contains a positive integer from the range [1, 1018], a number from Mirko’s list. No two numbers in the list will be equal.

출력

The first and only line of output must contain the number of pairs that are pals.

예제 입력 1

3
4
20
44

예제 출력 1

1

예제 입력 2

4
32
51
123
282

예제 출력 2

4
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.