#include<stdio.h>
#include<math.h>
#define MAX 1000000
long count;
int S[MAX];
int n;
int G[200000000];
int Glen=0;

void insertSort(int S[],int n,int gnum)
{
  int i,j;
  int t;
  for(i=gnum;i<n;i++)
    {
      t=S[i];
      j=i-gnum;
      while(j>=0 &&S[j]>t)
	{
	  S[j+gnum]=S[j];
	  j-=gnum;
	  count++;
	}
      S[j+gnum]=t;
    }
}

void shellSort(int S[],int n)
{
  int i=1,j=1;
  G[0]=1;
  while(1)
    {
      if(j>n)break;
      G[i]=3*i+1;
      j=3*i+1;
      i++;
      Glen++;
    }

  for(i=Glen-1;i>=0;i--) insertSort(S,n,G[i]);
}
int main()
{
  scanf("%d",&n);
  int i;
  for(i=0;i<n;i++)
    {
      scanf("%d",&S[i]);
    }
  count=0;
  shellSort(S,n);
  printf("%d\n",Glen);

  for(i=Glen-1;i>=0;i--)
    {
      printf("%d",G[i]);
      if(i)printf(" ");
    }
  printf("\n");
  printf("%d\n",count);
  for(i=0;i<n;i++)printf("%d\n",S[i]);
  return 0;
}