
import java.util.Scanner;

/**
 * Created by sd on 2016/11/22.
 */
public 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 count = 0;
        for(int i=0; i<N; i++){
            int minj = i;
            for(int j=i; j<N; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count ++;
            }
            int t = a[i];
            a[i] = a[minj];
            a[minj] = t;
        }
        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util public 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 count = 0;
        for(int i=0; i<N; i++){
            int minj = i;
            for(int j=i; j<N; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count ++;
            }
            int t = a[i];
            a[i] = a[minj];
            a[minj] = t;
        }
        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        System.out.println(count);
    }
} 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 count = 0;
        for(int i=0; i<N; i++){
            int minj = i;
            for(int j=i; j<N; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count ++;
            }
            int t = a[i];
            a[i] = a[minj];
            a[minj] = t;
        }
        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        System.out.println(count);
    } 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 count = 0;
        for(int i=0; i<N; i++){
            int minj = i;
            for(int j=i; j<N; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count ++;
            }
            int t = a[i];
            a[i] = a[minj];
            a[minj] = t;
        }
        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        System.out.println(count);
    } 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 count = 0; count 0 for(int i=0; i<N; i++){
            int minj = i;
            for(int j=i; j<N; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count ++;
            }
            int t = a[i];
            a[i] = a[minj];
            a[minj] = t;
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            int minj = i;
            for(int j=i; j<N; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count ++;
            }
            int t = a[i];
            a[i] = a[minj];
            a[minj] = t;
        } {
            int minj = i;
            for(int j=i; j<N; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count ++;
            }
            int t = a[i];
            a[i] = a[minj];
            a[minj] = t;
        } int minj = i; minj i for(int j=i; j<N; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            } int j=i; int j=i; j i j<N j N 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 if(i != minj){
                count ++;
            } i != minj i minj {
                count ++;
            } count ++ count int t = a[i]; t a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = t a[minj] a minj t for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        } int ii=0; int ii=0; ii 0 ii<N-1 ii N-1 N 1 ii++ ii++ ii {
            System.out.print(a[ii]+" ");
        } {
            System.out.print(a[ii]+" ");
        } System.out.print(a[ii]+" ") System.out.print System.out System System.out a[ii]+" " a[ii] a ii " " System.out.println(a[N-1]) System.out.println System.out System System.out a[N-1] a N-1 N 1 System.out.println(count) System.out.println System.out System System.out count String[] args args public 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 count = 0;
        for(int i=0; i<N; i++){
            int minj = i;
            for(int j=i; j<N; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count ++;
            }
            int t = a[i];
            a[i] = a[minj];
            a[minj] = t;
        }
        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        System.out.println(count);
    }
} public 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 count = 0;
        for(int i=0; i<N; i++){
            int minj = i;
            for(int j=i; j<N; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count ++;
            }
            int t = a[i];
            a[i] = a[minj];
            a[minj] = t;
        }
        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        System.out.println(count);
    }
} Main

import java.util.Scanner;

/**
 * Created by sd on 2016/11/22.
 */
public 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 count = 0;
        for(int i=0; i<N; i++){
            int minj = i;
            for(int j=i; j<N; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count ++;
            }
            int t = a[i];
            a[i] = a[minj];
            a[minj] = t;
        }
        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        System.out.println(count);
    }
}