#include <bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
//#pragma GCC optimize("Ofast")
// #pragma GCC optimize "trapv"
#define ll long long
#define lld long double
int main() {
// your code goes here
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
//cin>>t;
t=1;
while(t--)
{
ll n;
cin>>n;
int arr[n],mark[1001]={0};
for(int i=0;i<n;i++)
{
cin>>arr[i];
mark[arr[i]]++;
}
ll ans=0;
for(int i=n-1;i>=0;i--)
{
int x=arr[i];
for(int j=1;j<x;j++)
ans+=mark[j];
mark[x]--;
//cout<<ans<<"\n";
}
cout<<ans;
}
}
For which TC this will fail?
@ssjgz