408888: GYM103372 C Beautiful Numbers

Memory Limit:512 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Beautiful Numberstime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard output

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.

Input

First 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.

Output

Print one integer — the maximal number of the beautiful numbers that Byteazar can build simultaneously from the given cards.

ExamplesInput
6
1 9 9 7 9 3
Output
2
Input
11
1 1 1 1 1 1 1 1 1 2 8
Output
1
Input
3
4 5 7
Output
0

加入题单

上一题 下一题 算法标签: