import java.io.*; import java.util.*; import java.util.stream.*; // 処理 class Process { private PrintWriter printWriter; private int[] a; private int[] b; private int[] c; Process(PrintWriter printWriter, int[] a, int[] b, int[] c) { this.printWriter = printWriter; this.a = a; this.b = b; this.c = c; } // 結果を出力 void printResult() throws IOException { var itemCounts = new int[10]; for(int i = 0; i < a.length; i++) { itemCounts[a[i] - 1]++; itemCounts[b[i] - 1]++; itemCounts[c[i] - 1]++; } var powerUpCount = 0; for(int i = 0; i < itemCounts.length; i++) { powerUpCount += itemCounts[i] / 2; itemCounts[i] -= 2 * (itemCounts[i] / 2); } int sumOfItems = IntStream.of(itemCounts).sum(); powerUpCount += sumOfItems / 4; printWriter.println(powerUpCount); } } public class Main { public static void main(String[] args) throws IOException { var bufferedReader = new BufferedReader(new InputStreamReader(System.in)); var printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); // 入力 int N = Integer.parseInt(bufferedReader.readLine().trim()); var a = new int[N]; var b = new int[N]; var c = new int[N]; var input = new int[3]; for(int n = 0; n < N; n++) { input = Stream.of(bufferedReader.readLine().trim().split("[ ]+")).mapToInt(Integer::parseInt).toArray(); a[n] = input[0]; b[n] = input[1]; c[n] = input[2]; } // Process クラスで処理を行う var process = new Process(printWriter, a, b, c); process.printResult(); // 各ストリームを閉じる // 出力ストリームを閉じるときに標準出力に文字を出力する bufferedReader.close(); printWriter.close(); } }