long long IntegerSort (long long a[], long long *nn) {
    long h, l, j, n=*nn;
    long long k;
    for (h = n; h /= 2;) {
        for (l = h; l < n; l++) {
            k = a;
            for (j = l; j >= h && k < a[j - h]; j -= h) {
                a[j] = a[j - h];
            }
            a[j] = k;
        }
    }
    return 0;
}
