**QUESTION**

Shil got an array of N integers as a present on his birthday. But he didn’t liked it. Shil wants to make this array beautiful. Shil considers an array A1,A2,A3 . . . AN beautiful if A1> AN. Inorder to make it beautiful Shil can swap any two numbers in the array. Also Shil can perform this operation any number of times on any adjacent pairs of integers in the array A.Find the number of ways in which Shil can make this array beautiful.Two ways are considered same if resulting array after making all the swaps have same A1 and AN.\n\nInput\n\nFirst line of input contains an integer N denoting the number of elements in an array A. Next line of input contains N space separated integers denoting A1,A2,A3 . . . AN respectively.\n\nOutput\n\nNumber of ways in which you can make given array beautiful.\n\nConstraints\n\n1<=N<=106\n1<=Ai<=106\n\nWarning\n\nPrefer to use fast I/O methods.

“TESTCASE_1”: “5\n1 4 3 2 5\n###—###SEPERATOR—###—\n10”, “TESTCASE_2”: “10\n1 4 3 2 5 6 9 8 7 10\n###—###SEPERATOR—###—\n45”, “TESTCASE_3”: “32\n9384 887 2778 6916 7794 8336 5387 493 6650 1422 2363 28 8691 60 7764 3927 541 3427 9173 5737 5212 5369 2568 6430 5783 1531 2863 5124 4068 3136 3930 9803\n###—###SEPERATOR—###—\n496”, “TESTCASE_4”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_5”: “0\n###—###SEPERATOR—###—\n0

**ANSWER**

```
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a[n],i,k=0;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(k<a[i])
k=a[i];
}
int aux[k+1],j=0;
for(i=0;i<k+1;i++)
aux[i]=0;
for(i=0;i<n;i++)
aux[a[i]]++;
for(i=0;i<k+1;i++)
{
if(aux[i]>0)
j++;
}
long long s=0;
for(i=0;i<j;i++)
s+=(j-1-i);
printf("%lld",s);
return 0;
}
```