//  Ces programmes sont sous licence CeCILL-B V1.
void main() {
  int i, j, b, x, y, z, s;
  int[] tab = new int[16];
  int[] tab1 = new int[16];
  for(i = 0; i <= 15; i = i + 1)
	tab[i(intMath.floor(Math.random() 1000);
  for(i = 0; i <= 15; i = i + 1)
	print(tab[i" ");
  println();
  s = 1;
  while(s <= 15) {
	b = 0;
	x = 0;
	y = s;
	for(i = 0; i <= 15; i = i + 1) {
	  if(((x < b + s&& (y < b + * s&& (tab[x< tab[y])) || (y == b + * s)) {
		tab1[i= tab[x];
		x = x + 1;
	  else {
		tab1[i= tab[y];
		y = y + 1;
	  }
	  if((x == b + s&& (y == b + * s)) {
		b = b + * s;
		x = b;
		y = b + s;
	  }
	}
	for(i = 0; i <= 15; i = i + 1)
	  tab[i= tab1[i];
	s = s * 2;
  }
  for(i = 0; i <= 15; i = i + 1)
	print(tab[i" ");
  println();
}