from collections import defaultdict N = int(input()) S = [input() for _ in range(N)] d = defaultdict(int) for s in S: d[s.count("^")] += 1 mv = max(d.values()) cands = [k for k in d if mv == d[k]] print(sorted(cands)[-1])