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

A Simple Stone Game

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 8977    Accepted Submission(s): 1993


Problem Description
After he has learned how to play Nim game, Bob begins to try another stone game which seems much easier.

The game goes like this: one player starts the game with $N$ piles of stones. There is $a_i$ stones on the $i$th pile. On one turn, the player can move exactly one stone from one pile to another pile. After one turn, if there exits a number $x(x > 1)$ such that for each pile $b_i$ is the multiple of $x$ where $b_i$ is the number of stone of the this pile now), the game will stop. Now you need to help Bob to calculate the minimum turns he need to stop this boring game. You can regard that $0$ is the multiple of any positive number.
 

Input
The first line is the number of test cases. For each test case, the first line contains one positive number $N(1 \leq N \leq 100000)$, indicating the number of piles of stones.

The second line contains $N$ positive number, the $i$th number $a_i (1 \leq a_i \leq 100000)$ indicating the number of stones of the $i$th pile.


The sum of $N$ of all test cases is not exceed $5 * 10^5$.
 

Output
For each test case, output a integer donating the answer as described above. If there exist a satisfied number $x$ initially, you just need to output $0$. It's guaranteed that there exists at least one solution.
 

Sample Input
2 5 1 2 3 4 5 2 5 7
 

Sample Output
2 1
 

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-11-22 09:20:33, Gzip enabled