1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#include "message.h"
#include "teatr.h"
#include "bits/stdc++.h"
using namespace std;

int l[10000];

int main()
{
   int n = GetN();
   long long suma = 0;
   for (int i = 0; i < n; i++)
   {
      int c = GetElement(i);
      for (int j = c + 1; j < 6; j++)
         suma += l[j];
      l[c]++;
   }
   cout << suma;
}