#include<bits/stdc++.h>
using namespace std;
int n,cnt;
vector<int>A;
void insertionSort(int g){
  for(int i=g;i<n;i++){
    int v=A[i];
    int j=i-g;
    while(j>=0&&A[j]>v){
      A[j+g]=A[j];
      j-=g;
      cnt++;
    }
    A[j+g]=v;
  }
}
void shellSort(){
  int r=1;
  vector<int>G;
  while(r<=n){
    G.push_back(r);
    r*=2;
  }
  int m=G.size();
  reverse(G.begin(),G.end());
  cout<<m<<endl;
  for(int i=0;i<m;i++)cout<<G[i]<<" \n"[i==m-1];
  for(int i=0;i<m;i++)insertionSort(G[i]);
  cout<<cnt<<endl;
}
int main(){
  cin>>n;
  A.resize(n);
  for(int i=0;i<n;i++)cin>>A[i];
  shellSort();
  for(int i=0;i<n;i++)cout<<A[i]<<endl;
  return 0;
}

