import java.util.Scanner;

class Main{
    
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int A[] = new int[N];
	for(int i = 0;i < N;i++){
	    A[i] = sc.nextInt();
	}
	int cnt = 0, tmp, minj;
	for(int i = 0;i <= N - 1;i++){
	    minj = i;
	    int flag = 0;
	    for(int j = i;j <= N - 1;j++){
		if(A[j] < A[minj]){
		    minj = j;
		}		
	    }
	    tmp = A[i];
	    A[i] = A[minj];
	    A[minj] = tmp;
	    if(i == minj){
		flag = 1;
	    }
	    if(flag == 0){
		cnt++;
		}	   
	}	
	for(int k = 0;k < N;k++){
	    System.out.print(A[k]);
	    if(k == N - 1) break;
	    System.out.print(" ");
	}
	System.out.println("\n" + cnt);
    }
}
 import java.util.Scanner; Scanner java.util class Main{
    
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int A[] = new int[N];
	for(int i = 0;i < N;i++){
	    A[i] = sc.nextInt();
	}
	int cnt = 0, tmp, minj;
	for(int i = 0;i <= N - 1;i++){
	    minj = i;
	    int flag = 0;
	    for(int j = i;j <= N - 1;j++){
		if(A[j] < A[minj]){
		    minj = j;
		}		
	    }
	    tmp = A[i];
	    A[i] = A[minj];
	    A[minj] = tmp;
	    if(i == minj){
		flag = 1;
	    }
	    if(flag == 0){
		cnt++;
		}	   
	}	
	for(int k = 0;k < N;k++){
	    System.out.print(A[k]);
	    if(k == N - 1) break;
	    System.out.print(" ");
	}
	System.out.println("\n" + cnt);
    }
} Main public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int A[] = new int[N];
	for(int i = 0;i < N;i++){
	    A[i] = sc.nextInt();
	}
	int cnt = 0, tmp, minj;
	for(int i = 0;i <= N - 1;i++){
	    minj = i;
	    int flag = 0;
	    for(int j = i;j <= N - 1;j++){
		if(A[j] < A[minj]){
		    minj = j;
		}		
	    }
	    tmp = A[i];
	    A[i] = A[minj];
	    A[minj] = tmp;
	    if(i == minj){
		flag = 1;
	    }
	    if(flag == 0){
		cnt++;
		}	   
	}	
	for(int k = 0;k < N;k++){
	    System.out.print(A[k]);
	    if(k == N - 1) break;
	    System.out.print(" ");
	}
	System.out.println("\n" + cnt);
    } main {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int A[] = new int[N];
	for(int i = 0;i < N;i++){
	    A[i] = sc.nextInt();
	}
	int cnt = 0, tmp, minj;
	for(int i = 0;i <= N - 1;i++){
	    minj = i;
	    int flag = 0;
	    for(int j = i;j <= N - 1;j++){
		if(A[j] < A[minj]){
		    minj = j;
		}		
	    }
	    tmp = A[i];
	    A[i] = A[minj];
	    A[minj] = tmp;
	    if(i == minj){
		flag = 1;
	    }
	    if(flag == 0){
		cnt++;
		}	   
	}	
	for(int k = 0;k < N;k++){
	    System.out.print(A[k]);
	    if(k == N - 1) break;
	    System.out.print(" ");
	}
	System.out.println("\n" + cnt);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int A[] = new int[N]; A new int[N] N for(int i = 0;i < N;i++){
	    A[i] = sc.nextInt();
	} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
	    A[i] = sc.nextInt();
	} {
	    A[i] = sc.nextInt();
	} A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc int cnt = 0 cnt 0 tmp tmp minj; minj for(int i = 0;i <= N - 1;i++){
	    minj = i;
	    int flag = 0;
	    for(int j = i;j <= N - 1;j++){
		if(A[j] < A[minj]){
		    minj = j;
		}		
	    }
	    tmp = A[i];
	    A[i] = A[minj];
	    A[minj] = tmp;
	    if(i == minj){
		flag = 1;
	    }
	    if(flag == 0){
		cnt++;
		}	   
	} int i = 0; int i = 0; i 0 i <= N - 1 i N - 1 N 1 i++ i++ i {
	    minj = i;
	    int flag = 0;
	    for(int j = i;j <= N - 1;j++){
		if(A[j] < A[minj]){
		    minj = j;
		}		
	    }
	    tmp = A[i];
	    A[i] = A[minj];
	    A[minj] = tmp;
	    if(i == minj){
		flag = 1;
	    }
	    if(flag == 0){
		cnt++;
		}	   
	} {
	    minj = i;
	    int flag = 0;
	    for(int j = i;j <= N - 1;j++){
		if(A[j] < A[minj]){
		    minj = j;
		}		
	    }
	    tmp = A[i];
	    A[i] = A[minj];
	    A[minj] = tmp;
	    if(i == minj){
		flag = 1;
	    }
	    if(flag == 0){
		cnt++;
		}	   
	} minj = i minj i int flag = 0; flag 0 for(int j = i;j <= N - 1;j++){
		if(A[j] < A[minj]){
		    minj = j;
		}		
	    } int j = i; int j = i; j i j <= N - 1 j N - 1 N 1 j++ j++ j {
		if(A[j] < A[minj]){
		    minj = j;
		}		
	    } {
		if(A[j] < A[minj]){
		    minj = j;
		}		
	    } if(A[j] < A[minj]){
		    minj = j;
		} A[j] < A[minj] A[j] A j A[minj] A minj {
		    minj = j;
		} minj = j minj j tmp = A[i] tmp A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = tmp A[minj] A minj tmp if(i == minj){
		flag = 1;
	    } i == minj i minj {
		flag = 1;
	    } flag = 1 flag 1 if(flag == 0){
		cnt++;
		} flag == 0 flag 0 {
		cnt++;
		} cnt++ cnt for(int k = 0;k < N;k++){
	    System.out.print(A[k]);
	    if(k == N - 1) break;
	    System.out.print(" ");
	} int k = 0; int k = 0; k 0 k < N k N k++ k++ k {
	    System.out.print(A[k]);
	    if(k == N - 1) break;
	    System.out.print(" ");
	} {
	    System.out.print(A[k]);
	    if(k == N - 1) break;
	    System.out.print(" ");
	} System.out.print(A[k]) System.out.print System.out System System.out A[k] A k if(k == N - 1) break; k == N - 1 k N - 1 N 1 break; System.out.print(" ") System.out.print System.out System System.out " " System.out.println("\n" + cnt) System.out.println System.out System System.out "\n" + cnt "\n" cnt String[] args args
import java.util.Scanner;

class Main{
    
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int A[] = new int[N];
	for(int i = 0;i < N;i++){
	    A[i] = sc.nextInt();
	}
	int cnt = 0, tmp, minj;
	for(int i = 0;i <= N - 1;i++){
	    minj = i;
	    int flag = 0;
	    for(int j = i;j <= N - 1;j++){
		if(A[j] < A[minj]){
		    minj = j;
		}		
	    }
	    tmp = A[i];
	    A[i] = A[minj];
	    A[minj] = tmp;
	    if(i == minj){
		flag = 1;
	    }
	    if(flag == 0){
		cnt++;
		}	   
	}	
	for(int k = 0;k < N;k++){
	    System.out.print(A[k]);
	    if(k == N - 1) break;
	    System.out.print(" ");
	}
	System.out.println("\n" + cnt);
    }
}

