#include <iostream>
using namespace std;
int main () {
    int arr[] = {0, 1, 2, 3, 4, 5, 8, 9};
    int n=8;
    
    int comparisons = 0;
    int swaps = 0;
    for (int i = 1; i < n - 1; i++)
     {
        int key = arr[i];
        int j = i - 1;
         	comparisons++;
         while (j >= 0 && arr[j] > key); {
         	arr[j+1] = arr[j];
         	j = j - 1;
         }
                swaps++;
    	
    }
    cout << "Відсортований масив ";
    for (int i = 0; i < n; i++) {
    	cout << arr[i] << " ";
    }
    cout << endl;
    cout << "Кількість порівняннь: " << comparisons << endl;
    cout << "Кількість обмінів: " << swaps << endl;
    
    return 0;
}