MSKYCODE - Sky Code

题意翻译

给你n个数,现在让你求出有多少个四元组,满足这四个数的最大公约数等于1,n<=10000,每个数<=10000,多组询问,对于每个询问回答多少个四元组满足条件

题目描述

Stancu likes space travels but he is a poor software developer and will never be able to buy his own spacecraft. That is why he is preparing to steal the spacecraft of Petru. There is only one problem – Petru has locked the spacecraft with a sophisticated cryptosystem based on the ID numbers of the stars from the Milky Way Galaxy. For breaking the system Stancu has to check each subset of four stars such that the only common divisor of their numbers is $1$. Nasty, isn’t it? Fortunately, Stancu has succeeded to limit the number of the interesting stars to $n$ but, any way, the possible subsets of four stars can be too many. Help him to find their number and to decide if there is a chance to break the system.

输入输出格式

输入格式


In the input file several test cases are given. For each test case on the first line the number $n$ of interesting stars is given $(1 \leq n \leq 10000)$. The second line of the test case contains the list of ID numbers of the interesting stars, separated by spaces. Each ID is a positive integer which is no greater than $10000$. The input data terminate with the end of file.

输出格式


For each test case the program should print one line with the number of subsets with the asked property.

输入输出样例

输入样例 #1

4
2 3 4 5
4
2 4 6 8
7
2 3 4 5 7 6 8

输出样例 #1

1
0
34