include[HTML_REMOVED]
using namespace std;
const int N=100010;
int q[N],tmp[N];
unsigned long long merge_sort(int q[],int l,int r) //返回逆序数
{
if (l>=r) return 0;
else
{
int mid=(l+r)>>2;
unsigned long long res=0;
res+=merge_sort(q,l,mid);
res+=merge_sort(q,mid+1,r);
int i=l, j=mid+1,k=0;
while (i<=mid && j<=r)
{
if(q[i]>q[j]) { tmp[k++]=q[j++]; res+=mid-i+1;}
else tmp[k++]=q[i++];
}
while (i<=mid) tmp[k++]=q[i++];
while (j<=r) tmp[k++]=q[j++];
for (int i=l,j=0;i<=r;i++,j++)
{
q[i]=tmp[j];
}
return res;
}
}
int main()
{
int n;
cin>>n;
for (int i=0;i[HTML_REMOVED]>q[i];
}
cout<<merge_sort(q,0,n-1);
return 0;
}