from collections import * N = int(input()) C = Counter() for i in range(N): C[list(input()).count("^")] += 1 ma = C.most_common()[0][1] ans = -1 for k, v in C.items(): if v == ma: ans = max(ans, k) print(ans)