Poe the Penguin is working on a robbery case. He has a list of N suspects, labelled from 1 to N to conceal their identity, standing in front of him.

Poe the Penguin has innate skills in figuring out who is guilty and who is not. Therefore, he has narrowed down his selection of suspects to a set of prime suspects. A prime suspect is someone whose label is a prime. Out of all the prime suspects, Poe the Penguin believes that the oldest suspect commited the robbery. If there are more than 1 prime suspect with the same age, Poe the Penguin believes that the person with the biggest label committed the crime.

Given the above information, Poe the Penguin wants to know who committed the robbery. Help him.

Input

The first line contains a single integer N.

The next line contains N positive integers. The ith integer from the right denotes the age of the person with label i.

You can assume that 1 ≤ N ≤ 1000.

Output

Output the label of the prime suspect..

Sample Input

10
4 8 2 9 5 4 8 2 9 5

Sample Output

7  

Sample Explanation

The prime suspects are those with labels 2, 3, 5 and 7. Their ages are 9, 2, 4 and 9 respectively. The suspects with labels 2 and 7 are the oldest, but we know that the person with the greater label committed the crime. Therefore, suspect 7 committed the crime.