N = int(input()) S = [] for _ in range(N): S.append(input()) print(max(set(S),key=S.count).count("^"))