import java.util.Scanner;

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-1;i++){
            a[i] = sc.nextInt();
        }
        int count = 0;
        for(int i=0;i<N-1;i++){
            int minj = i;
            for (int j=i+1;j<N;j++){
                if (a[minj] > a[j]) {
                    minj = j;
                }
            }
            if(i == minj) {
                continue;
            }
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
            count++;
        }
        for(int i=0;i<N-1;i++){
            System.out.printf("%d ",a[i]);
        }
        System.out.printf("%d",a[N-1]);
        System.out.printf("\n%d\n",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-1;i++){
            a[i] = sc.nextInt();
        }
        int count = 0;
        for(int i=0;i<N-1;i++){
            int minj = i;
            for (int j=i+1;j<N;j++){
                if (a[minj] > a[j]) {
                    minj = j;
                }
            }
            if(i == minj) {
                continue;
            }
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
            count++;
        }
        for(int i=0;i<N-1;i++){
            System.out.printf("%d ",a[i]);
        }
        System.out.printf("%d",a[N-1]);
        System.out.printf("\n%d\n",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-1;i++){
            a[i] = sc.nextInt();
        }
        int count = 0;
        for(int i=0;i<N-1;i++){
            int minj = i;
            for (int j=i+1;j<N;j++){
                if (a[minj] > a[j]) {
                    minj = j;
                }
            }
            if(i == minj) {
                continue;
            }
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
            count++;
        }
        for(int i=0;i<N-1;i++){
            System.out.printf("%d ",a[i]);
        }
        System.out.printf("%d",a[N-1]);
        System.out.printf("\n%d\n",count);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a[] = new int[N];
        for(int i=0;i<=N-1;i++){
            a[i] = sc.nextInt();
        }
        int count = 0;
        for(int i=0;i<N-1;i++){
            int minj = i;
            for (int j=i+1;j<N;j++){
                if (a[minj] > a[j]) {
                    minj = j;
                }
            }
            if(i == minj) {
                continue;
            }
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
            count++;
        }
        for(int i=0;i<N-1;i++){
            System.out.printf("%d ",a[i]);
        }
        System.out.printf("%d",a[N-1]);
        System.out.printf("\n%d\n",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-1;i++){
            a[i] = sc.nextInt();
        } int i=0; int i=0; i 0 i<=N-1 i N-1 N 1 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-1;i++){
            int minj = i;
            for (int j=i+1;j<N;j++){
                if (a[minj] > a[j]) {
                    minj = j;
                }
            }
            if(i == minj) {
                continue;
            }
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
            count++;
        } int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
            int minj = i;
            for (int j=i+1;j<N;j++){
                if (a[minj] > a[j]) {
                    minj = j;
                }
            }
            if(i == minj) {
                continue;
            }
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
            count++;
        } {
            int minj = i;
            for (int j=i+1;j<N;j++){
                if (a[minj] > a[j]) {
                    minj = j;
                }
            }
            if(i == minj) {
                continue;
            }
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
            count++;
        } int minj = i; minj i for (int j=i+1;j<N;j++){
                if (a[minj] > a[j]) {
                    minj = j;
                }
            } int j=i+1; int j=i+1; j i+1 i 1 j<N j N j++ j++ j {
                if (a[minj] > a[j]) {
                    minj = j;
                }
            } {
                if (a[minj] > a[j]) {
                    minj = j;
                }
            } if (a[minj] > a[j]) {
                    minj = j;
                } a[minj] > a[j] a[minj] a minj a[j] a j {
                    minj = j;
                } minj = j minj j if(i == minj) {
                continue;
            } i == minj i minj {
                continue;
            } continue; int 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 count++ count for(int i=0;i<N-1;i++){
            System.out.printf("%d ",a[i]);
        } int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
            System.out.printf("%d ",a[i]);
        } {
            System.out.printf("%d ",a[i]);
        } System.out.printf("%d ",a[i]) System.out.printf System.out System System.out "%d " a[i] a i System.out.printf("%d",a[N-1]) System.out.printf System.out System System.out "%d" a[N-1] a N-1 N 1 System.out.printf("\n%d\n",count) System.out.printf System.out System System.out "\n%d\n" 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-1;i++){
            a[i] = sc.nextInt();
        }
        int count = 0;
        for(int i=0;i<N-1;i++){
            int minj = i;
            for (int j=i+1;j<N;j++){
                if (a[minj] > a[j]) {
                    minj = j;
                }
            }
            if(i == minj) {
                continue;
            }
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
            count++;
        }
        for(int i=0;i<N-1;i++){
            System.out.printf("%d ",a[i]);
        }
        System.out.printf("%d",a[N-1]);
        System.out.printf("\n%d\n",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-1;i++){
            a[i] = sc.nextInt();
        }
        int count = 0;
        for(int i=0;i<N-1;i++){
            int minj = i;
            for (int j=i+1;j<N;j++){
                if (a[minj] > a[j]) {
                    minj = j;
                }
            }
            if(i == minj) {
                continue;
            }
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
            count++;
        }
        for(int i=0;i<N-1;i++){
            System.out.printf("%d ",a[i]);
        }
        System.out.printf("%d",a[N-1]);
        System.out.printf("\n%d\n",count);
    }
} Main
import java.util.Scanner;

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-1;i++){
            a[i] = sc.nextInt();
        }
        int count = 0;
        for(int i=0;i<N-1;i++){
            int minj = i;
            for (int j=i+1;j<N;j++){
                if (a[minj] > a[j]) {
                    minj = j;
                }
            }
            if(i == minj) {
                continue;
            }
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
            count++;
        }
        for(int i=0;i<N-1;i++){
            System.out.printf("%d ",a[i]);
        }
        System.out.printf("%d",a[N-1]);
        System.out.printf("\n%d\n",count);
    }
}
