Maze movement

No attempts yetTime limit2sMemory limit256 MB

Problem

Your boss gave you the task of designing a walk-through maze, and you are comparing several layouts. Before you settle on one, you want to know how quickly people can move in and out of each layout. Your boss wants this venture to make money, and the faster people move through, the more paying customers you can handle.

A maze is a set of numbered rooms and the passages connecting them. The only entrance is the lowest-numbered room and the only exit is the highest-numbered room.

Each passage limits how many people can pass through at a time. For rooms numbered xx and yy, a passage joins them whenever the greatest common divisor of xx and yy is larger than 11. Call that divisor pp. Then pp people per minute can walk from xx to yy, and at the same time pp people per minute can walk from yy to xx. The entrance, the exit, and every room handle any number of people at a time. People want to get through the maze as quickly as possible, so they never wait in a room.

Input

The input describes a single maze. The first line holds the number of rooms nn. (2n10002 \le n \le 1000)

Each of the next nn lines holds one room number. The room numbers are distinct, and each one is between 22 and 2×1092 \times 10^9.

Output

Print the largest number of people per minute that can enter the maze, assuming people leave the maze at the same rate they enter it. No maze given in the input supports more than 10910^9 people entering per minute.