import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

int cnt;

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

void ShellSort(int[] arr, int n){
	cnt = 0;
	int m;
	int[] g;
	for(int i = 1; ; ){
		g ~= i;
		i = 3*i + 1;
		if(i > n) break;
	}
	reverse(g);
	m = g.length.to!int();
	//writeln("m : ",m);
	writeln(m);
	for(int i = 0; i < m; ++i){
		//write("g[", i ,"] : ", g[i]);
		write(g[i]);
		if(i == m-1)	writeln();
		else	write(" ");
	}

	for(int i = 0; i < m; ++i){
		InsertionSort(arr, n, g[i]);
	}
}

int main(string[] argv)
{
	auto n = readln.chomp.to!int();
	int[] arr;

	for(int i = 0; i < n; ++i){
		arr ~= readln.chomp.to!int();
	}

	ShellSort(arr, n);
	//writeln("cnt : ", cnt);
	writeln(cnt);
	foreach(e; arr){
		writeln(e);
	}

    return 0;
}