#include #include auto main() -> int { int level = 0; std::vector counts(10); int n; std::cin >> n; int a, b, c; for (int i = 0; i < n; ++i) { std::cin >> a >> b >> c; counts[a-1]++; counts[b-1]++; counts[c-1]++; } for (int i = 0; i < 10;) { if (counts[i] >= 2) { counts[i]--; counts[i]--; level++; continue; } i++; } int count4 = 0; for (int i = 0; i < 10;) { if (counts[i] >= 1) { counts[i]--; count4++; if (count4 == 4) { count4 = 0; level++; } continue; } i++; } std::cout << level << std::endl; }