import java.util.*; class Yuki29{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); int n = stdIn.nextInt(); int[] count = new int[10]; int box=0; int answer=0; for(int i=0;i<n*3;i++){ int input = stdIn.nextInt(); if(input==10) input =0; count[input] += 1; if(count[input]==2){ count[input] -= 2; answer += 1; } } for(int i=0;i<10;i++){ box+=count[i]; } answer += (int)(box/4); System.out.println(answer); } }