from collections import Counter, defaultdict, deque from sys import stdin, stdout input = lambda: stdin.readline().rstrip() write = stdout.write def main(): N = int(input()) S = stdin.read().splitlines() counter = Counter(S) topn = counter.most_common() maxn, eyes = 0, 0 for s, i in topn: if maxn <= i: maxn = i eyes = max(eyes, s.count('^')) print(eyes) main()