n = io.read("*n") t = {} cnt = 0 for i = 1, n * 3 do a = io.read("*n") if(t[a] == nil) then t[a] = true else t[a], cnt = nil, cnt + 1 end end subcnt = 0 for k, v in pairs(t) do if(subcnt == 3) then subcnt, cnt = 0, cnt + 1 else subcnt = subcnt + 1 end end print(cnt)