F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Coffee shop in Jioufen

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65535/65536 K (Java/Others)
Total Submission(s): 425    Accepted Submission(s): 147


Problem Description
Cheer manages a coffee shop in Jioufen. As she is the only assistant in the shop, it is a big problem for her to mix up raw materials into a cup of coffee.
To simplify the problem, we can assume that Cheer has n kinds of raw material, and the i-th raw material has been assigned with a value ai denoting its level of deliciousness.
For some unknown reason, Cheer believe that a kind of coffee is perfect if and only if the value of its all kinds of raw materials are co-prime with each other. A kind of perfect coffee also can be made without any of these raw materials, only by water.
Now given n kinds of raw material and their value of deliciousness, find out how many distinct kinds of perfect coffee can be made by them. Note that two kinds of coffee are considered distinct if and only if the raw material sets of them are distinct.
 

Input
There are at most 75 test cases.
For each case, The first line contains one integer n indicating the number of kind of raw material.
The next line contains n integers separated by space, denoting deliciousness values: a1, a2, ..., an
(1 <= n <= 60, 1 <= ai <= 231-1)
The input ends with n = 0
 

Output
For each test case, print the number of distinct kind of prefect coffee she can made in one line.
 

Sample Input
2 2 2 3 1 2 3 3 2 3 4 0
 

Sample Output
3 8 6
 

Hint

For the first case, there 3 distinct kinds of perfect coffee: none of these raw materials, only with the first kind of raw material, and only with the second kind of raw material. Coffee with both the first kind of raw material and the second is not considered as perfect coffee, because the deliciousness levels of first kind of raw material and the second are not co-prime.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-26 22:09:08, Gzip enabled