print((function (h, n) function count(r) for _,v in pairs(h) do if v == 1 then r = r + 1 end end return math.floor(r / 4) end for _=1,io.stdin:read("*n")*3 do local t = io.stdin:read("*n") if h[t] == 1 then h[t],n = 0,n+1 else h[t] = 1 end end return n + count(0) end)({}, 0))