import sys def solve(): N = int(input()) hako = [sorted([int(i) for i in input().split()]) for j in range(N)] hako.sort() inf = 10**9 dp = [[inf, inf, inf] for i in range(N)] dp[0] = hako[0] for i in range(1, N): for j in range(N): if not is_larger(dp[j], hako[i]): if is_larger(hako[i], dp[j]): dp[j] = hako[i] break # print(dp) ans = len([tyoku for tyoku in dp if tyoku != [inf]*3]) print(ans) def is_larger(a, b): for i in range(3): if b[i] <= a[i]: return False return True def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None if __name__ == '__main__': solve()