Getting WA in DBYZ15A

Problem statement: CodeChef: Practical coding for everyone

My (WA) solution: CodeChef: Practical coding for everyone

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.