#include <stdio.h>

#define Max 1000

void printA(int A[Max], int N) {
	int i;

	for (i = 0; i < N - 1; i++)
		printf("%d ", A[i]);
	printf("%d\n", A[i]);
}

int insertionSort(int A[Max], int N, int g) {
	int i, j, v;
	int cnt = 0;

	for (i = g; i < N; i++) {
		v = A[i];
		j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j + g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
	}

	return cnt;
}

void shellSort(int A[Max], int N) {
	int i = 0;
	int cnt = 0;
	int m = 0;
	int G[Max];

	m = N;

	if	(m < 4)		m = 0;
	else if (m % 3 == 0)	m -= 3;
	else if (m % 3 == 2)	m -= 2;
	else					m -= 1;
	m = m / 3 + 1;

	printf("%d\n", m);

	for (i = m - 1; i >= 0; i--)
		G[m - i - 1] = 3 * i + 1;

	printA(G, m);

	for (i = 0; i < m; i++) cnt += insertionSort(A, N, G[i]);

	printf("%d\n", cnt);

	for (i = 0; i < N; i++) printf("%d\n", A[i]);
}

int main( ) {
	int N, i, j;
	int A[Max];

	scanf("%d", &N);

	for (i = 0; i < N; i++) scanf("%d", &A[i]);

	shellSort(A, N);

	return 0;
}