N = int(input()) power_up = [] count = 0 for i in range(N): items = list(map(int, input().split())) for item in items: if item in power_up: power_up.remove(item) count += 1 else: power_up.append(item) if len(power_up) >= 4: while len(power_up) >= 4: del power_up[:4] count += 1 print(count)