import java.util.Scanner; public class No29 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] items = new int[10]; for (int i = 0; i < n; i++) { int[] gets = new int[3]; for (int j = 0; j < gets.length; j++) { gets[j] = sc.nextInt() - 1; } for (int j = 0; j < gets.length; j++) { items[gets[j]]++; } } int powerUpCnt = 0; for (int i = 0; i < items.length; i++) { powerUpCnt += items[i] / 2; items[i] = items[i] % 2; } while (canPowerUp(items)) { int cnt = 0; for (int i = 0; i < items.length; i++) { if (items[i] > 0) { cnt++; items[i]--; if (cnt >= 4) { powerUpCnt++; break; } } } } System.out.println(powerUpCnt); sc.locale(); } private static boolean canPowerUp(int[] items) { int cnt = 0; for (int val : items) { if (val > 0) { cnt++; } } if (cnt >= 4) { return true; } else { return false; } } }