package me.yukicoder.lv1; import java.util.Scanner; public class No0029 { 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 * 3; i++) { int itemNum = sc.nextInt(); items[itemNum - 1] = items[itemNum - 1] + 1; } int upCnt = 0; int modCnt = 0; for (int i : items) { upCnt = upCnt + (i / 2);// 同じアイテム2つでパワーアップ modCnt = modCnt + (i % 2); } upCnt = upCnt + (modCnt / 4);// 任意のアイテム4つでパワーアップ System.out.println(upCnt); } }