class Problem0029: def solve(this): n = int(input()) res = {} for i in range(n): a,b,c = map(int, input().split()) res[a] = res.get(a, 0) + 1 res[b] = res.get(b, 0) + 1 res[c] = res.get(c, 0) + 1 cnt = 0 remain = 0 for v in res.values(): cnt += v // 2 remain += v % 2 cnt += remain // 5 print(cnt) if __name__ == "__main__": problem = Problem0029() problem.solve()