import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.Math;
import java.lang.StringBuffer;

/*Question
/?¬????????????°?????????????????\?????????????????¨?????? n ????????´??°???????????°??? A??????????????´?????????????????°???????????¬??????????????§??????
/1  insertionSort(A, n, g)
/2      for i = g to n-1
/3          v = A[i]
/4          j = i - g
/5          while j >= 0 && A[j] > v
/6              A[j+g] = A[j]
/7              j = j - g
/8              cnt++
/9          A[j+g] = v
/10
/11 shellSort(A, n)
/12     cnt = 0
/13     m = ?
/14     G[] = {?, ?,..., ?}
/15     for i = 0 to m-1
/16         insertionSort(A, n, G[i])
/shellSort(A, n) ????????????????????? g????????¢??????????´??????????????±???¨???????????\???????????§?????? insertionSort(A, n, g) ?????????????????§??????????????? g????????????????????°????????????????????????????????§??????????????¨?¨?????????????
/???????????????????????? ? ??????????????????????????°???????????????????????????????????????n??¨??°??? A ???????????????????????§???????????????????????? m???m ????????´??° Gi(i=0,1,...,m???1)?????\??? A????????????????????????????????????????????°????????????????????????????????????
/???????????????????????\???????????¶?????? ??????????????????????????????
/1???m???100
/0???Gi???n
/cnt ????????? ??¬??????n^1.5????¶??????????????????????

/*Input
/1 ???????????´??° n ?????????????????????????¶???? n ????????? n ????????´??° Ai(i=0,1,...,n???1) ???????????????????????? 
*/

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		/*??\???
		/??????????´???°?????\???????¬??????????????????\???
		*/
		int n = Integer.parseInt(sc.readLine());
		int[] a = new int[n];
		for (int i = 0;i < n;i++) 
			a[i] = Integer.parseInt(sc.readLine());
		/*??°??????shell???????????????
		/?????£??????????????????????????????
		*/
		shell(a,n);
		for (int s:a)
			System.out.println(s);
	}

	/*insertion????????????
	/?????\???????????????????????????
	/????????????????´???????????????????????´???¨??????????????????
	/??????????´?????°??????????????????????????´???¨??\????????????????????°?????????
	*/
	static int insertion(int[] a,int n, int g){
		//???????????????(????????????)
		int cnt = 0;
		int j,v;
		for (int i = g;i < n;i++){
			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;
		}
		return cnt;
	}

	/*shell????????????
	/?????§??????????????????????????????
	/?????\??????????????????????????????????????§????????\?????????????????¨??????????????¨????????¨
	/m??¨g[]???????????§???????????¨????????¨
	/m???n/2???g???0???m-1?????§????????°?????§???(3^i-1)/2??????(i:1???m)????????¨??????
	*/
	static void shell(int[] a,int n){
		//????????¨
		StringBuffer br = new StringBuffer();
		//m?????£??\
		int m = 1;
		//g??¨m???????´???¨
		int c = ((int)Math.pow(3,m)-1)/2;
		while (c < n/3){
			m++;
			c = ((int)Math.pow(3,m)-1)/2;
		}
		//m?????????
		br.append(m+"\n");
		//cnt???????´???¨
		int cnt = 0;
		//g[]?????\???
		c = 0;
		int g[] = new int[m];
		for (int i = m;i > 0;i--) {
			g[c] = ((int)Math.pow(3,i)-1)/2;
			c++;
		}
		//g[]?????????
		for (int s:g)
			br.append(s + " ");
		br.deleteCharAt(br.lastIndexOf(" "));
		br.append("\n");
		//??????????????????a,n,g?????????
		for (int i = 0;i < g.length;i++)
			cnt += insertion(a, n, g[i]);
		//cnt?????????
		br.append(cnt+"\n");
		System.out.print(br);
	}
}

Measured memory_bytes: 106752