Sophia is playing a game on the computer. There are two random arrays A & B, each having the same number of elements. The game begins with Sophia removing a pair (Ai, Bj) from the array if they are not co-prime. She keeps a count on the number of times this operation is done.
Sophia wants to find out the maximal number of times(S) she can do this on the arrays. Could you help Sophia find the value?
The first line contains an integer n. 2 lines follow, each line containing n numbers separated by a single space. The format is shown below.
A A ... A[n - 1]
B B ... B[n - 1]
0 < n <= 105
2 <= A[i], B[i] <= 109
Each element in both arrays are generated randomly between 2 and 109
Output S which is the maximum number of times the above operation can be made.