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() print(topn[0][0].count('^')) main()