from collections import Counter as c print(c(map(len,[input() for _ in range(int(input()))])).most_common(1)[0][0]-2)