Do You Know Your ABCs?

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Farmer John's cows have been holding a daily online gathering on the "mooZ" video meeting platform. For fun, they have invented a simple number game to play during the meeting to keep themselves entertained.

Elsie has three positive integers AA, BB, and CC (1ABC1\le A\le B\le C). These integers are supposed to be secret, so she will not directly reveal them to her sister Bessie. Instead, she tells Bessie NN (4N74\le N\le 7) distinct integers x_1,x_2,,x_Nx\_1,x\_2,\ldots,x\_N (1x_i1091\le x\_i\le 10^9), claiming that each x_ix\_i is one of AA, BB, CC, A+BA+B, B+CB+C, C+AC+A, or A+B+CA+B+C. However, Elsie may be lying; the integers x_ix\_i might not correspond to any valid triple (A,B,C)(A,B,C).

This is too hard for Bessie to wrap her head around, so it is up to you to determine the number of triples (A,B,C)(A,B,C) that are consistent with the numbers Elsie presented (possibly zero).

Each input file will contain TT (1T1001\le T\le 100) test cases that should be solved independently.

입력

The first input line contains TT.

Each test case starts with NN, the number of integers Elsie gives to Bessie.

The second line of each test case contains NN distinct integers x_1,x_2,,x_Nx\_1,x\_2,\ldots,x\_N.

출력

For each test case, output the number of triples (A,B,C)(A,B,C) that are consistent with the numbers Elsie presented.

힌트

For x=4,5,7,9x=\\{4,5,7,9\\}, the five possible triples are as follows: (2,2,5),(2,3,4),(2,4,5),(3,4,5),(4,5,7).(2, 2, 5), (2, 3, 4), (2, 4, 5), (3, 4, 5), (4, 5, 7).