N = int(input()) L = [i for i in range(1001)] for i in range(N): S = input() n = len(S) L[n-2] += 1000 L.sort(reverse=True) print(L[0]%1000)