
ZOJ Problem Set  2728
"Fighting against the Overlord" is a very popular poker game in China. This game uses a standard deck of 52 cards, plus 2 jokers, namely 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A, 2, Colorless Joker(denoted as L) and Colorful Joker(denoted as F), from LOW rank to HIGH rank. The game is played between an "Overlord" and two "Peasants". At the beginning to the game, the overload has 20 poker cards and each peasant has 17 cards, then they play cards based on the rules which will be introduced shortly. If the overload first finishes with all his cards played, the overload wins, otherwise the two peasants win.
RULES:
In this problem, given n(0 <= n <= 20) cards, you are asked to write a program, which outputs the minimum number of plays the player needs to play all his cards. Please note that you don't need to consider the other players' strategies. Input The input file contains several test cases. Each test case has two lines. The first line is an integer m, indicating the number of cards and the second line contains m cards. Output For each test case, output the minimum number of plays on a single line. Sample Input 8 3 3 3 4 4 4 3 4 20 3 4 5 6 7 8 9 10 J Q 5 6 7 8 9 10 J Q K A 20 F L 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 J Q K Sample Output 1 2 1 Author: JIANG, Jiefeng Source: Zhejiang University Local Contest 2006 