#include #include #include #include // パワーアップ int main() { enum PowerUp { SAME_NEED = 2, WRONG_NEED = 4, }; int input = 0; int item[100] = { 0 }; int powerUp = 0; int cnt = 0; scanf("%d", &input); for (int i = 0;i < input;i++, cnt++) { int n = 0; bool flag = false; scanf("%d", &n); for (int j = 0;j <= i;j++) { if (item[j] == n) { item[j]++; flag = true; if (item[j] >= SAME_NEED) { item[j] -= SAME_NEED; cnt -= SAME_NEED; powerUp++; } } } if (!flag) { item[i] = n; } } powerUp += cnt / 4; printf("%d", powerUp); return 0; }