#include<iostream>
#include<vector>
using namespace std;

void show(int arr[], int N){
	for(int i=0; i<N; i++)
		if(i<N-1)
			cout<<arr[i]<<' '<<flush;
		else
			cout<<arr[i]<<flush;
	cout<<endl;
}


void swap(int& a, int& b){
	int t=a;
	a=b;
	b=t;
}


int ShellSort(int* arr, int N);
int InsertionSort_r(int* arr, int N, int r);

int main()
{
	int N;cin>>N;

	int* arr= new int[N];

	for(int i=0; i<N; i++)
		cin>>arr[i];

	int count=ShellSort(arr, N);

	cout<<count<<endl;

	for( int i=0; i<N; i++)
		cout<<arr[i]<<endl;

	delete[] arr;
}


int ShellSort(int* arr, int N)
{
	int counter=0;


	vector<int> range;

	for( int i=1; i<=N; i= i*3 +1 )
		range.push_back(i);






	
	cout<<range.size()<<endl;

	for( int i=range.size() -1; i >=0; i-- )
		cout<<range[ i ]<<' '<<flush;
	cout<<endl;







	 

	for( int i=range.size() -1; i>=0; i-- ) 
		counter=InsertionSort_r(arr, N, range[ i ]);
	
	return counter;

	
	



	
}

int InsertionSort_r(int arr[], int N, int r)
{

	static int counter=0;
	int compindex;
	int comp;
	int j;

	
	for( int i=0; i<r; i++) {


		for( int compindex=N- r -1 -i ; compindex> -1; compindex-=r ){
			
			comp=arr[compindex];
			j=r;
			for( ; compindex+j<N; j+=r ){

				if(comp > arr[compindex+j]){
					arr[compindex + j -r] = arr[compindex + j];
					counter++;
				}
				else
					break;
				
			}
			arr[compindex + j - r] = comp;

		


		}
	}
	return counter;
}
/* ?§£??????????????????????????????
	  o x x o x x x *
	  o x x o x x o *
	  x o x x o x x
	  x x o x x o x
  ??¨???????????????????????????????????????????????§???
  	  o x x o x x x *
	  x o x x o x x
	  x x o x x o x
	  o x x o x x o *
?????¨?????????????§£?????????
????????????????????¨????????????????????????(0.2?§????????§£?????????????????????????)
   
int InsertionSort_r(int arr[], int N, int r)
{
	static int cnt=0;
	bool changed=false;
	for( int compindex=r; compindex<N; compindex++) {

		int comp= arr[compindex];

		int j=compindex - r;

		for( ; j>=0; j-=r ) {
			if(arr[j] > comp){
				arr[ j+r ]=arr[j];
				cnt++;
				changed=true;
			}
			else
				break;
		}

		arr[ j+r ] =comp;


		changed=false;
	}
	return cnt;
}
*/
#include <iostream>
#include <algorithm>
#include <vector>
typedef int TInt;
typedef std::vector<TInt> TList;

TList Input()
{
    int Count;
    std::cin >> Count;
    TList List(Count);
    for(int i = 0; i < Count; ++i){
        std::cin >> List[i];
    }
    return List;
}
int insertionSort(TList& A, int g)
{
    int cnt = 0;
    for(int i = g; i < A.size(); ++i){
        TInt v = A[i];
        int j = i - g;
        while(j >= 0 && A[j] > v){
            A[j+g] = A[j];
            j = j - g;
            cnt++;
        }
        A[j+g] = v;
    }
    return cnt;
}
void Reverse(TList& List)
{
    TList R;
    for(TList::reverse_iterator It = List.rbegin();
        It != List.rend();
        ++It)
    {
        R.push_back(*It);
    }
    std::swap(R, List);
}
TList GetG(int Max)
{
    TList G;
    int h = 1;
    while(h <= Max){
        G.push_back(h);
        h = 3 * h + 1;
    }
    // Reverse(G);
    std::reverse(G.begin(), G.end());
    return G;
}
int shellSort(TList& A, const TList& G)
{
    int cnt = 0;
    for(TList::const_iterator It = G.begin();
        It != G.end();
        ++It){
        cnt += insertionSort(A, *It);
    }
    return cnt;
}
void OutputLine(const TList& List)
{
    TList::const_iterator It = List.begin();
    std::cout << *(It++);
    for(; It != List.end(); ++It){
        std::cout << " " << *It;
    }
    std::cout << std::endl;
}
void Output(const TList& List)
{
    TList::const_iterator It = List.begin();
    // std::cout << *(It++);
    for(; It != List.end(); ++It){
        std::cout << *It << std::endl;
    }
}
int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    TList A = Input();
    TList G = GetG(A.size());
    int cnt = shellSort(A, G);
    std::cout << G.size() << std::endl;
    OutputLine(G);
    std::cout << cnt << std::endl;
    Output(A);
    return 0;   
}