408888: GYM103372 C Beautiful Numbers
Description
Byteazar calls the positive integer beautiful if the sum of its digits is equal to 10. Byteazar got $$$n$$$ cards, each card containing one digit between 1 and 9, inclusively, on the face.
Count the maximal number of the beautiful numbers that can be built from the given cards simultaneously, i.e. that any card can be used in no more than one integer.
For example, if we have the cards with digits 1,9,9,7,9,3, we can build two beautiful numbers: first with the digits 1 and 9 and second with the digits 7 and 3. From cards 1,1,1,1,1,1,1,1,1,2,8 we can build only one beautiful number (use 8 and 2, or two ones and 8, or eight ones and 2). From the set of cards 4, 5, 7 we cannot build any beautiful number.
InputFirst line of the input contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — number of cards. Second line contains $$$n$$$ integers $$$a_i$$$ ($$$1 \le a_i \le 9$$$) — the numbers that are written on the faces of the cards.
OutputPrint one integer — the maximal number of the beautiful numbers that Byteazar can build simultaneously from the given cards.
ExamplesInput6 1 9 9 7 9 3Output
2Input
11 1 1 1 1 1 1 1 1 1 2 8Output
1Input
3 4 5 7Output
0