#P8646. [蓝桥杯 2017 省 AB] 包子凑数

[蓝桥杯 2017 省 AB] 包子凑数

Description

Xiaoming eats breakfast at a baozi shop almost every morning. He found that the shop has NN types of steamers. The ii-th type of steamer can hold exactly AiA_i baozi. There are many steamers of each type, which can be considered unlimited.

Whenever a customer wants to buy XX baozi, the seller will quickly choose some steamers so that the total number of baozi in these steamers is exactly XX. For example, there are 33 types of steamers that can hold 33, 44, and 55 baozi. When a customer wants to buy 1111 baozi, the seller will choose 22 steamers of 33 plus 11 steamer of 55 (or he may choose 11 steamer of 33 plus 22 steamers of 44).

Of course, sometimes the seller cannot make up the number the customer wants, no matter what. For example, there are 33 types of steamers that can hold 44, 55, and 66 baozi. When a customer wants to buy 77 baozi, the seller cannot make it.

Xiaoming wants to know how many amounts cannot be made up by the seller.

Input Format

The first line contains an integer NN. (1N100)(1 \le N \le 100).

The next NN lines each contain an integer AiA_i. (1Ai100)(1 \le A_i \le 100).

Output Format

Output an integer as the answer. If there are infinitely many amounts that cannot be made up, output INF.

2  
4  
5  
6
2  
4  
6   
INF

Hint

For sample 11, the amounts that cannot be made up include: 1,2,3,6,7,111,2,3,6,7,11.

For sample 22, all odd numbers cannot be made up, so there are infinitely many.

Lanqiao Cup 2017 Provincial Contest, Group A, Problem H.

Translated by ChatGPT 5