Chest named Vova, like all the other chests, dreams of becoming a real safe for his owner. To do this, he wants to make an unusual combination lock. Whoever wants to open it will be given a square matrix of size N \times N, filled with random numbers. These numbers need to be made prime by using only two operations:
increase the number by ;
decrease the number by .
Recall that a number is called prime if it is greater than one and has no divisors other than one and itself.
As the answer, output the minimum number of operations after which the lock will open.
The first line contains the size of the matrix (1 \leq n \leq 50). Each of the next lines contains integers. This is matrix generated by the lock. To tell you the truth, elements are not entirely random. It is known that each element is non-negative and not greater than 10^{18}.
Output one number — the minimum number of operations after which the lock will open.
Example 1