n=int(input()) print(max([input().count('^')for i in range(n)]))