Getting WA in DBYZ15A

Problem statement: http://www.codechef.com/DBYZ15/problems/DBYZ15A

My (WA) solution: http://www.codechef.com/viewsolution/6599625

Logic:
First i am calculating the frequency of occurance of each number
then i am calculating all possible pair of distint numbers.Can anybody please tell me why i am getting wrong answer.

Does your code follow the condition

( i < j )

can you please elaborate above condition or provide any test case for which my code give wrong answer.

@pushpinder001 , I meant, that in the problem statement, it says " He needs to report the number of pairs (i,j) where i < j … " . So I’m asking if you are following that condition.

yes my code is following (i<j) condition.