import java.util.*;
//import java.lang.Math;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        A=new int[N];
        for(int i=0;i<N;i++) A[i]=sc.nextInt();
        int cnt=0;
        for(int i=0;i<N;i++){
            int mi=i;
            for(int j=i;j<N;j++) if(A[j]<A[mi]) mi=j;
            if(mi!=i) cnt++;
            int tmp=A[i];
            A[i]=A[mi];
            A[mi]=tmp;
        }
        for(int i=0;i<N;i++){
            System.out.print(A[i]);
            System.out.print(i==N-1?"\n":" ");
        }
        System.out.println(cnt);
        sc.close();
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        A=new int[N];
        for(int i=0;i<N;i++) A[i]=sc.nextInt();
        int cnt=0;
        for(int i=0;i<N;i++){
            int mi=i;
            for(int j=i;j<N;j++) if(A[j]<A[mi]) mi=j;
            if(mi!=i) cnt++;
            int tmp=A[i];
            A[i]=A[mi];
            A[mi]=tmp;
        }
        for(int i=0;i<N;i++){
            System.out.print(A[i]);
            System.out.print(i==N-1?"\n":" ");
        }
        System.out.println(cnt);
        sc.close();
    }
} Main public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        A=new int[N];
        for(int i=0;i<N;i++) A[i]=sc.nextInt();
        int cnt=0;
        for(int i=0;i<N;i++){
            int mi=i;
            for(int j=i;j<N;j++) if(A[j]<A[mi]) mi=j;
            if(mi!=i) cnt++;
            int tmp=A[i];
            A[i]=A[mi];
            A[mi]=tmp;
        }
        for(int i=0;i<N;i++){
            System.out.print(A[i]);
            System.out.print(i==N-1?"\n":" ");
        }
        System.out.println(cnt);
        sc.close();
    } main {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        A=new int[N];
        for(int i=0;i<N;i++) A[i]=sc.nextInt();
        int cnt=0;
        for(int i=0;i<N;i++){
            int mi=i;
            for(int j=i;j<N;j++) if(A[j]<A[mi]) mi=j;
            if(mi!=i) cnt++;
            int tmp=A[i];
            A[i]=A[mi];
            A[mi]=tmp;
        }
        for(int i=0;i<N;i++){
            System.out.print(A[i]);
            System.out.print(i==N-1?"\n":" ");
        }
        System.out.println(cnt);
        sc.close();
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc int A[]; A 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] A i sc.nextInt() sc.nextInt sc int cnt=0; cnt 0 for(int i=0;i<N;i++){
            int mi=i;
            for(int j=i;j<N;j++) if(A[j]<A[mi]) mi=j;
            if(mi!=i) cnt++;
            int tmp=A[i];
            A[i]=A[mi];
            A[mi]=tmp;
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            int mi=i;
            for(int j=i;j<N;j++) if(A[j]<A[mi]) mi=j;
            if(mi!=i) cnt++;
            int tmp=A[i];
            A[i]=A[mi];
            A[mi]=tmp;
        } {
            int mi=i;
            for(int j=i;j<N;j++) if(A[j]<A[mi]) mi=j;
            if(mi!=i) cnt++;
            int tmp=A[i];
            A[i]=A[mi];
            A[mi]=tmp;
        } int mi=i; mi i for(int j=i;j<N;j++) if(A[j]<A[mi]) mi=j; int j=i; int j=i; j i j<N j N j++ j++ j if(A[j]<A[mi]) mi=j; if(A[j]<A[mi]) mi=j; A[j]<A[mi] A[j] A j A[mi] A mi mi=j mi j if(mi!=i) cnt++; mi!=i mi i cnt++ cnt int tmp=A[i]; tmp A[i] A i A[i]=A[mi] A[i] A i A[mi] A mi A[mi]=tmp A[mi] A mi tmp for(int i=0;i<N;i++){
            System.out.print(A[i]);
            System.out.print(i==N-1?"\n":" ");
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            System.out.print(A[i]);
            System.out.print(i==N-1?"\n":" ");
        } {
            System.out.print(A[i]);
            System.out.print(i==N-1?"\n":" ");
        } System.out.print(A[i]) System.out.print System.out System System.out A[i] A i System.out.print(i==N-1?"\n":" ") System.out.print System.out System System.out i==N-1?"\n":" " i==N-1 i N-1 N 1 "\n" " " System.out.println(cnt) System.out.println System.out System System.out cnt sc.close() sc.close sc String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        A=new int[N];
        for(int i=0;i<N;i++) A[i]=sc.nextInt();
        int cnt=0;
        for(int i=0;i<N;i++){
            int mi=i;
            for(int j=i;j<N;j++) if(A[j]<A[mi]) mi=j;
            if(mi!=i) cnt++;
            int tmp=A[i];
            A[i]=A[mi];
            A[mi]=tmp;
        }
        for(int i=0;i<N;i++){
            System.out.print(A[i]);
            System.out.print(i==N-1?"\n":" ");
        }
        System.out.println(cnt);
        sc.close();
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        A=new int[N];
        for(int i=0;i<N;i++) A[i]=sc.nextInt();
        int cnt=0;
        for(int i=0;i<N;i++){
            int mi=i;
            for(int j=i;j<N;j++) if(A[j]<A[mi]) mi=j;
            if(mi!=i) cnt++;
            int tmp=A[i];
            A[i]=A[mi];
            A[mi]=tmp;
        }
        for(int i=0;i<N;i++){
            System.out.print(A[i]);
            System.out.print(i==N-1?"\n":" ");
        }
        System.out.println(cnt);
        sc.close();
    }
} Main
import java.util.*;
//import java.lang.Math;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        A=new int[N];
        for(int i=0;i<N;i++) A[i]=sc.nextInt();
        int cnt=0;
        for(int i=0;i<N;i++){
            int mi=i;
            for(int j=i;j<N;j++) if(A[j]<A[mi]) mi=j;
            if(mi!=i) cnt++;
            int tmp=A[i];
            A[i]=A[mi];
            A[mi]=tmp;
        }
        for(int i=0;i<N;i++){
            System.out.print(A[i]);
            System.out.print(i==N-1?"\n":" ");
        }
        System.out.println(cnt);
        sc.close();
    }
}
