import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int times = scan.nextInt();
		int num[] =new int[times];
		int temp = 0;
		int min = 0;
		int banchi = 0;
		int finir = 0;
		int irekae = 0;
		int i = 0;
		for(i=0;i<times;i++){
			num[i] = scan.nextInt();
		}
		i = 0;
		int bot = num.length-1;
		int pre = bot-1;
		while (times != 1){
			min = num[finir];
			banchi = finir;
//			????°????????????°?????¢???
			for(int ii=finir;ii<times;ii++){
				if(min > num[ii]){
					min = num[ii];
					banchi = ii;
				}
			}
//				????????????????????°?????¨????°????????????°?????\????????????
			if(finir != banchi){
				temp = num[finir];
				num[finir] = num[banchi];
				num[banchi] = temp;
				irekae += 1;
			}
			
			finir +=1;
			
			if(finir == times-i){//???-1????????????????????\?????????????°??????????
				break;
			}
		}
		for(i=0;i<times;i++){
			System.out.print(num[i]);
			if(i == times-1){
				System.out.println("");
				System.out.println(irekae);
			}
			else{
				System.out.print(" ");
			}

		}
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int times = scan.nextInt();
		int num[] =new int[times];
		int temp = 0;
		int min = 0;
		int banchi = 0;
		int finir = 0;
		int irekae = 0;
		int i = 0;
		for(i=0;i<times;i++){
			num[i] = scan.nextInt();
		}
		i = 0;
		int bot = num.length-1;
		int pre = bot-1;
		while (times != 1){
			min = num[finir];
			banchi = finir;
//			????°????????????°?????¢???
			for(int ii=finir;ii<times;ii++){
				if(min > num[ii]){
					min = num[ii];
					banchi = ii;
				}
			}
//				????????????????????°?????¨????°????????????°?????\????????????
			if(finir != banchi){
				temp = num[finir];
				num[finir] = num[banchi];
				num[banchi] = temp;
				irekae += 1;
			}
			
			finir +=1;
			
			if(finir == times-i){//???-1????????????????????\?????????????°??????????
				break;
			}
		}
		for(i=0;i<times;i++){
			System.out.print(num[i]);
			if(i == times-1){
				System.out.println("");
				System.out.println(irekae);
			}
			else{
				System.out.print(" ");
			}

		}
	}
} Main public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int times = scan.nextInt();
		int num[] =new int[times];
		int temp = 0;
		int min = 0;
		int banchi = 0;
		int finir = 0;
		int irekae = 0;
		int i = 0;
		for(i=0;i<times;i++){
			num[i] = scan.nextInt();
		}
		i = 0;
		int bot = num.length-1;
		int pre = bot-1;
		while (times != 1){
			min = num[finir];
			banchi = finir;
//			????°????????????°?????¢???
			for(int ii=finir;ii<times;ii++){
				if(min > num[ii]){
					min = num[ii];
					banchi = ii;
				}
			}
//				????????????????????°?????¨????°????????????°?????\????????????
			if(finir != banchi){
				temp = num[finir];
				num[finir] = num[banchi];
				num[banchi] = temp;
				irekae += 1;
			}
			
			finir +=1;
			
			if(finir == times-i){//???-1????????????????????\?????????????°??????????
				break;
			}
		}
		for(i=0;i<times;i++){
			System.out.print(num[i]);
			if(i == times-1){
				System.out.println("");
				System.out.println(irekae);
			}
			else{
				System.out.print(" ");
			}

		}
	} main {
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int times = scan.nextInt();
		int num[] =new int[times];
		int temp = 0;
		int min = 0;
		int banchi = 0;
		int finir = 0;
		int irekae = 0;
		int i = 0;
		for(i=0;i<times;i++){
			num[i] = scan.nextInt();
		}
		i = 0;
		int bot = num.length-1;
		int pre = bot-1;
		while (times != 1){
			min = num[finir];
			banchi = finir;
//			????°????????????°?????¢???
			for(int ii=finir;ii<times;ii++){
				if(min > num[ii]){
					min = num[ii];
					banchi = ii;
				}
			}
//				????????????????????°?????¨????°????????????°?????\????????????
			if(finir != banchi){
				temp = num[finir];
				num[finir] = num[banchi];
				num[banchi] = temp;
				irekae += 1;
			}
			
			finir +=1;
			
			if(finir == times-i){//???-1????????????????????\?????????????°??????????
				break;
			}
		}
		for(i=0;i<times;i++){
			System.out.print(num[i]);
			if(i == times-1){
				System.out.println("");
				System.out.println(irekae);
			}
			else{
				System.out.print(" ");
			}

		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int times = scan.nextInt(); times scan.nextInt() scan.nextInt scan int num[] =new int[times]; num new int[times] times int temp = 0; temp 0 int min = 0; min 0 int banchi = 0; banchi 0 int finir = 0; finir 0 int irekae = 0; irekae 0 int i = 0; i 0 for(i=0;i<times;i++){
			num[i] = scan.nextInt();
		} i=0; i=0 i 0 i<times i times i++ i++ i {
			num[i] = scan.nextInt();
		} {
			num[i] = scan.nextInt();
		} num[i] = scan.nextInt() num[i] num i scan.nextInt() scan.nextInt scan i = 0 i 0 int bot = num.length-1; bot num.length-1 num.length num num.length 1 int pre = bot-1; pre bot-1 bot 1 while (times != 1){
			min = num[finir];
			banchi = finir;
//			????°????????????°?????¢???
			for(int ii=finir;ii<times;ii++){
				if(min > num[ii]){
					min = num[ii];
					banchi = ii;
				}
			}
//				????????????????????°?????¨????°????????????°?????\????????????
			if(finir != banchi){
				temp = num[finir];
				num[finir] = num[banchi];
				num[banchi] = temp;
				irekae += 1;
			}
			
			finir +=1;
			
			if(finir == times-i){//???-1????????????????????\?????????????°??????????
				break;
			}
		} times != 1 times 1 {
			min = num[finir];
			banchi = finir;
//			????°????????????°?????¢???
			for(int ii=finir;ii<times;ii++){
				if(min > num[ii]){
					min = num[ii];
					banchi = ii;
				}
			}
//				????????????????????°?????¨????°????????????°?????\????????????
			if(finir != banchi){
				temp = num[finir];
				num[finir] = num[banchi];
				num[banchi] = temp;
				irekae += 1;
			}
			
			finir +=1;
			
			if(finir == times-i){//???-1????????????????????\?????????????°??????????
				break;
			}
		} min = num[finir] min num[finir] num finir banchi = finir banchi finir for(int ii=finir;ii<times;ii++){
				if(min > num[ii]){
					min = num[ii];
					banchi = ii;
				}
			} int ii=finir; int ii=finir; ii finir ii<times ii times ii++ ii++ ii {
				if(min > num[ii]){
					min = num[ii];
					banchi = ii;
				}
			} {
				if(min > num[ii]){
					min = num[ii];
					banchi = ii;
				}
			} if(min > num[ii]){
					min = num[ii];
					banchi = ii;
				} min > num[ii] min num[ii] num ii {
					min = num[ii];
					banchi = ii;
				} min = num[ii] min num[ii] num ii banchi = ii banchi ii if(finir != banchi){
				temp = num[finir];
				num[finir] = num[banchi];
				num[banchi] = temp;
				irekae += 1;
			} finir != banchi finir banchi {
				temp = num[finir];
				num[finir] = num[banchi];
				num[banchi] = temp;
				irekae += 1;
			} temp = num[finir] temp num[finir] num finir num[finir] = num[banchi] num[finir] num finir num[banchi] num banchi num[banchi] = temp num[banchi] num banchi temp irekae += 1 irekae 1 finir +=1 finir 1 if(finir == times-i){//???-1????????????????????\?????????????°??????????
				break;
			} finir == times-i finir times-i times i {//???-1????????????????????\?????????????°??????????
				break;
			} break; for(i=0;i<times;i++){
			System.out.print(num[i]);
			if(i == times-1){
				System.out.println("");
				System.out.println(irekae);
			}
			else{
				System.out.print(" ");
			}

		} i=0; i=0 i 0 i<times i times i++ i++ i {
			System.out.print(num[i]);
			if(i == times-1){
				System.out.println("");
				System.out.println(irekae);
			}
			else{
				System.out.print(" ");
			}

		} {
			System.out.print(num[i]);
			if(i == times-1){
				System.out.println("");
				System.out.println(irekae);
			}
			else{
				System.out.print(" ");
			}

		} System.out.print(num[i]) System.out.print System.out System System.out num[i] num i if(i == times-1){
				System.out.println("");
				System.out.println(irekae);
			}
			else{
				System.out.print(" ");
			} i == times-1 i times-1 times 1 {
				System.out.println("");
				System.out.println(irekae);
			} System.out.println("") System.out.println System.out System System.out "" System.out.println(irekae) System.out.println System.out System System.out irekae {
				System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " String[] args args
import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int times = scan.nextInt();
		int num[] =new int[times];
		int temp = 0;
		int min = 0;
		int banchi = 0;
		int finir = 0;
		int irekae = 0;
		int i = 0;
		for(i=0;i<times;i++){
			num[i] = scan.nextInt();
		}
		i = 0;
		int bot = num.length-1;
		int pre = bot-1;
		while (times != 1){
			min = num[finir];
			banchi = finir;
//			????°????????????°?????¢???
			for(int ii=finir;ii<times;ii++){
				if(min > num[ii]){
					min = num[ii];
					banchi = ii;
				}
			}
//				????????????????????°?????¨????°????????????°?????\????????????
			if(finir != banchi){
				temp = num[finir];
				num[finir] = num[banchi];
				num[banchi] = temp;
				irekae += 1;
			}
			
			finir +=1;
			
			if(finir == times-i){//???-1????????????????????\?????????????°??????????
				break;
			}
		}
		for(i=0;i<times;i++){
			System.out.print(num[i]);
			if(i == times-1){
				System.out.println("");
				System.out.println(irekae);
			}
			else{
				System.out.print(" ");
			}

		}
	}
}