QOJ.ac

QOJ

Time Limit: 0.3 s Memory Limit: 32 MB Total points: 100

#6714. Vivian's Problem

الإحصائيات

The desire to explore the unknown has been a driving force in human history since the dawn of time. From the earliest documented accounts, ancient civilizations had explored the earth by sailing around. Early adventurers were motivated by religious beliefs, the desire conquest, the need to establish trade routes, and hunger for gold.

You never know what will happen before the exploration. Neither does Bruce Lee. Someday, Mr.Lee entered a desolate tropical rainforest. And after several days' exploring, he came in front of a cave with something blinking in it. A beautiful girl named Vivian came out just before he tried to go into the cave. And Vivian told Mr. Lee that he must answer some questions before he entered the cave. As the best friend of Mr. Lee, you should help him to work it out.

You will get $k$ positive integers $p_1, p_2, \cdots, p_i, \cdots, p_k$ ($1 \leq i \leq k$) from Vivian. From these numbers, you can calculate $N$, $N =\displaystyle \prod_{i=1}^kp_i^{e_i}$ ($0 \leq e_i \leq 10$, $\sum_{i=1}^ke_i \geq 1$, $1 \leq i \leq k$); you may decide the integers eis as you wish. From one $N$, you can calculate corresponding $M$, which equals to the sum of all divisors of $N$. Now, you should tell Vivian whether or not there is an $M$ which is the power of $2$ (1,2, 4, 8, and 16 … so on). If there's no $N$ can make $M$ equal to the power of 2, tell Vivian "NO". If $M$ equals to some $2^x$, then show her the exponent ($x$). And if there are several $x$, only show her the largest one.

Input

Input contains several testcases. For each testcase, the first line contains only one integer $k$ ($0 < k \leq 100$), representing the number of positive integers. Then there are $k$ positive integers $p_1, p_2, \cdots, p_i, \cdots p_k$ ($1 < p_i < 2^{31}$, $1 \leq i \leq k$) in the second line, representing the given numbers.

Input is terminated by end of file.

Output

For each testcase, you should output your result in a single line. If you can find $N$ from the given numbers, output the largest exponent. Otherwise, output "NO". Extra spaces are not allowed.

Sample Input

1
2
3
2 3 4

Sample Output

NO
2
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.