C) Love for GCD

3

1 votes
Easy, Math
Problem

One day while going across the topic GCD Adi came across a very simple question.

You are given an array consisting of N integers.

You have to find the number of pairs in the array such that GCD(A[ i ],A[ j ]) <MIN(A[ i ],A[ j ])

INPUT

First line contains an integer N denoting the size of the array.

Next line contain N space separated integers dentoing the array.


OUTPUT

Find the number of pairs such that GCD(A[ i ],A[ j ]) <MIN(A[ i ],A[ j ]).


CONSTRAINT

2N105

0A[i]105

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Possible Pairs are

(2,3) , (3,4) 

Editor Image

?