SP32950 ADAPLNTS - Ada and Plants 2
Description
Ada the Ladybug is a farmer. She has two furrows with plants. Each plant has some kind (denoted by number). Problem is, that as soon as there is a pair of plants with **gcd** greater than 1 in distinct furrows none of them will grow. Ada has decided to throw away minimal number of plants so that every remaining plant will grow up.
She has asked you to count the maximal number of plants which could grow up.
Input Format
The first line of each test-case will contain two integers **1 , the number of plants and first and in second furrow.**
The next will contain **N** integers **1 , the kinds of plants in first furrow.**
The next will contain **M** integers **1 , the kinds of plants in second furrow.**
Output Format
For each test-case, print the maximum number of plants which could grow up.