#K556. Minimum Operations to Reduce Array

    ID: 30011 Type: Default 1000ms 256MiB

Minimum Operations to Reduce Array

Minimum Operations to Reduce Array

You are given an array of n integers. In one operation, you can choose any two elements ai and aj (with 1 ≤ i < j ≤ n) such that either ai \mid aj or aj \mid ai (i.e. either ai % aj == 0 or aj % ai == 0). When this condition holds, you delete the larger element from the array.

Your task is to determine the minimum number of operations required to reduce the array to a single element. Operations can be performed in any order.

Note: Make sure your solution is efficient enough to handle relatively large inputs.

inputFormat

The first line contains an integer n representing the number of elements in the array.

The second line contains n space-separated integers, the elements of the array.

outputFormat

Output a single integer representing the minimum number of operations required to reduce the array to a single element.

## sample
4
2 3 6 9
2

</p>