| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 1 | 1 | 1 | 100.000% |
WINNER is fed up with implementing the Z-function for the 500-th time at his new accountant job at NUP, and now he is looking for a quick way to retire. Thanks to his wide network of connections, he managed to obtain the winning numbers from all the $n$ lotteries in Paphos. These winning numbers are written in base 12ドル,ドル where the numbers can include leading zeros.
However, the lotteries couldn't agree on a standard for representing the digits 10ドル$ and 11ドル$ using letters (from the uppercase English alphabet), so each lottery uses its own choice of two letters for these values. Despite having access to this information, WINNER is still uncertain about the exact rules for winning. He suspects that, in order to claim a prize, he only needs to correctly guess at least one digit from the winning number for each lottery.
WINNER forgot how to write with pen and paper, so he needs help figuring out the minimum number of unique alphanumerics he should learn in order to "win" (according to his understanding) at all the lotteries.
The input begins with a single integer $n$ (1ドル \leq n \leq 2.5 \cdot 10^5$), representing the number of lotteries.
Each of the next $n$ lines contains a number in base 12ドル,ドル representing the winning numbers for each lottery. For each line, there is an uppercase letter that means the digit 10ドル,ドル and a different uppercase letter that means the digit 11ドル$. This line can contain only digits and these two letters.
It is guaranteed that the total length of all the numbers is at most 4ドル \cdot 10^6$.
The output should consist of a single integer, $k,ドル indicating the minimum number of unique alphanumerics WINNER needs to learn in order to believe he can win every lottery.
4 EEXEE X221 DEE 2555539BD
2