#B4021. Counting Memory Fragment Events

    ID: 11678 Type: Default 1000ms 256MiB

Counting Memory Fragment Events

Counting Memory Fragment Events

During a period of chaos, the wind's memories were fragmented into \( n \) pieces, where the \( i \)th fragment has a characteristic value \( a_i \). Define the last \( p \) digits of an integer \( x \) as \( x \bmod 10^p \). Memory fragments whose characteristic values share the same last \( t \) digits are considered to belong to the same event.

Your task is to determine the number of distinct events among the \( n \) memory fragments.

inputFormat

The first line contains three integers \( n \), \( p \), and \( t \) separated by spaces.

The second line contains \( n \) integers \( a_1, a_2, \dots, a_n \), which represent the characteristic values of each fragment.

outputFormat

Output a single integer representing the number of distinct events.

sample

5 3 2
123 223 323 124 224
2