Problem1956--【基础】算24点(2)

1956: 【基础】算24点(2)

Time Limit: 1.000 Sec  Memory Limit: 128 MB
Submit: 2  Solved: 2
[Submit] [Status] [Web Board] [Creator:][下载测试数据]

Description

给出n个整数,请问这n个数字在不改变顺序且不加入括号的情况下,有多少种运算能得到24。

比如:4 10 2 4 8,有如下3种运算能够得到24。

4+10-2+4+8=24

4-10-2+4*8=24

4*10-2*4-8=24


Input

第1行有一个整数n;(2<=n<=10)

第2行有n个整数ai;(1<=ai<=100)


Output

一个整数,代表能计算出24点的方案数;

Sample Input

5
4 10 2 4 8

Sample Output

3

Source/Category


[Submit] [Status]