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;
	int tmp = 0, sum = 0;
	for(int i = 0; i < n; ++i){
		if(tmp < arr[i])	tmp = arr[i];
		sum += arr[i];
	}
	if(tmp == 1) g ~= 1;
	if(tmp > n)	tmp = n;
	//writeln("tmp : ", tmp);
	while(tmp > 1){
		tmp -= sum/n < n ? sum/n : n/2;
		if(tmp < 1)	tmp = 1;
		g ~= tmp;
	}
	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;
}