import sys
n = int(input())
count= 1
dict1 = {}
memory = 0
for _ in range(n):
    word = sys.stdin.readline()
    if not word in dict1:
        dict1[word] = 1
    else:
        dict1[word] += 1
    if dict1[word] == count:
        memory += 1
        dict1[word] -= 10**9
        # 其实可以建个集合,memorized = set()然后len,不用这么野蛮
        count += 1    
print(memory)