#include <iostream.h>
#include <conio.h>
using namespace std;

int insert (int n, int x[])
{
 int i, j, t, counter = 0, zamen = 0, vs=0;
 for (i=0; i<n; i++)
 {
   t = x[i];
   counter += i; // были-бы сравнения пока i>0
   // операций сравнения думаю будет в counter и ((n*n)-n)/2 одинаково
   for (j=i-1; j>=0 && vs++ /* vs */ && x[j]>t; j--)
   {
     x[j+1]=x[j];
     // колличество замен надо считать здесь наверное
     zamen++;
   }
   x[j+1]=t;
 }

 cout << vs <<" vsego sravnenij" << endl;
 cout << counter <<" maximum sravnenij" << endl;
  return zamen;
}

int main()
{
 int x[]= {4, 8,2,84,12,1};
 int n=6;

 cout << ((n*n)-n)/2 <<" ~~   maximum" << endl;
 cout << insert(n, x)<<" zamen" << endl;
 for(int t = 0; t < n; t++)
 {
   cout << x[t] << " ";
 }

 getch();
 return 0;
}