#include <stdio.h>

int cnt;

void insertionSort(int A[], int n, int g) {
    int i, j, v;
    for (i = g; i < n; i += g) {
	v = A[i];
	j = i - g;
	while ((j >= 0) && (A[j] > v)) {
	    A[j + g] = A[j];
	    j = j - g;
	    cnt++;
	}
	A[j + g] = v;
    }
}

void shellSort(int A[], int n) {
    cnt = 0;
    int i, m = 2;
    int G[] = {4, 1};
    for (i = 0; i < m; i++) {
	insertionSort(A, n, G[i]);
    }
    printf("%d\n", m);
    for (i = 0; i < m; i++) {
	printf("%d", G[i]);
	if (i == (m - 1))
	    printf("\n");
	else
	    printf(" ");
    }
    printf("%d\n", cnt);
    for (i = 0; i < n; i++) {
	printf("%d\n", A[i]);
    }
}

int main() {
    int n;
    scanf("%d", &n);
    int i, A[n];
    for (i = 0; i < n; i++) {
	scanf("%d", A + i);
    }
    shellSort(A, n);
    return 0;
}