/*
AUTORE: Manuel Vichi

*/
#include <iostream>
using namespace std;

void insertionSort(int arr[], int n) {
    for (int i = 1; i < n; i++) {
        int key = arr[i];
        int j = i - 1;
        
        while (j >= 0 && arr[j] > key) {
            arr[j + 1] = arr[j];
            j--;
        }
        arr[j + 1] = key;
    }
}
int eliminaDuplicati(int arr[], int n) {
	int finalSize = n;
	for (int i = n; i > n/2; i--) {
		for (int j = 0; j < n; j++) {
			if (arr[i] == arr[j]) {
				arr[j] = arr[i];
				finalSize--;
			}
		}
	}
	return finalSize;
}
void printArray(int arr[], int n) {
    for (int i = 0; i < n; i++) {
        cout << arr[i] << " ";
    }
    cout << endl;
}

int main() {
    int v1[] = {1, 2, 2, 3, 4, 3, 5, 6, 6, 7};
    int n = sizeof(v1) / sizeof(v1[0]);
    printArray(v1,n);
    insertionSort(v1, n);
    
    return 0;
}