import java.util.Scanner;

public class Main {
    static int selectSort(int[] data) {
        int ret = 0, n = data.length;
        for (int i = 0; i < n; ++i) {
            int minJ = i;
            for (int j = i; j < n; ++j) {
                if (data[j] < data[minJ]) minJ = j;
            }
            if(minJ != i) {
                ++ret;
                int tmp = data[minJ];
                data[minJ] = data[i];
                data[i] = tmp;
            }
        }
        return ret;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] data = new int[n];

        for (int i = 0; i < n; ++i) {
            data[i] = scanner.nextInt();
        }

        int cnt = selectSort(data);
        for (int i = 0; i < n; ++i) {
            System.out.print(data[i]);
            if (i != n - 1) System.out.print(" ");
        }
        System.out.println();
        System.out.println(cnt);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    static int selectSort(int[] data) {
        int ret = 0, n = data.length;
        for (int i = 0; i < n; ++i) {
            int minJ = i;
            for (int j = i; j < n; ++j) {
                if (data[j] < data[minJ]) minJ = j;
            }
            if(minJ != i) {
                ++ret;
                int tmp = data[minJ];
                data[minJ] = data[i];
                data[i] = tmp;
            }
        }
        return ret;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] data = new int[n];

        for (int i = 0; i < n; ++i) {
            data[i] = scanner.nextInt();
        }

        int cnt = selectSort(data);
        for (int i = 0; i < n; ++i) {
            System.out.print(data[i]);
            if (i != n - 1) System.out.print(" ");
        }
        System.out.println();
        System.out.println(cnt);
    }
} Main static int selectSort(int[] data) {
        int ret = 0, n = data.length;
        for (int i = 0; i < n; ++i) {
            int minJ = i;
            for (int j = i; j < n; ++j) {
                if (data[j] < data[minJ]) minJ = j;
            }
            if(minJ != i) {
                ++ret;
                int tmp = data[minJ];
                data[minJ] = data[i];
                data[i] = tmp;
            }
        }
        return ret;
    } selectSort {
        int ret = 0, n = data.length;
        for (int i = 0; i < n; ++i) {
            int minJ = i;
            for (int j = i; j < n; ++j) {
                if (data[j] < data[minJ]) minJ = j;
            }
            if(minJ != i) {
                ++ret;
                int tmp = data[minJ];
                data[minJ] = data[i];
                data[i] = tmp;
            }
        }
        return ret;
    } int ret = 0 ret 0 n = data.length; n data.length data data.length for (int i = 0; i < n; ++i) {
            int minJ = i;
            for (int j = i; j < n; ++j) {
                if (data[j] < data[minJ]) minJ = j;
            }
            if(minJ != i) {
                ++ret;
                int tmp = data[minJ];
                data[minJ] = data[i];
                data[i] = tmp;
            }
        } 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 (data[j] < data[minJ]) minJ = j;
            }
            if(minJ != i) {
                ++ret;
                int tmp = data[minJ];
                data[minJ] = data[i];
                data[i] = tmp;
            }
        } {
            int minJ = i;
            for (int j = i; j < n; ++j) {
                if (data[j] < data[minJ]) minJ = j;
            }
            if(minJ != i) {
                ++ret;
                int tmp = data[minJ];
                data[minJ] = data[i];
                data[i] = tmp;
            }
        } int minJ = i; minJ i for (int j = i; j < n; ++j) {
                if (data[j] < data[minJ]) minJ = j;
            } int j = i; int j = i; j i j < n j n ++j ++j j {
                if (data[j] < data[minJ]) minJ = j;
            } {
                if (data[j] < data[minJ]) minJ = j;
            } if (data[j] < data[minJ]) minJ = j; data[j] < data[minJ] data[j] data j data[minJ] data minJ minJ = j minJ j if(minJ != i) {
                ++ret;
                int tmp = data[minJ];
                data[minJ] = data[i];
                data[i] = tmp;
            } minJ != i minJ i {
                ++ret;
                int tmp = data[minJ];
                data[minJ] = data[i];
                data[i] = tmp;
            } ++ret ret int tmp = data[minJ]; tmp data[minJ] data minJ data[minJ] = data[i] data[minJ] data minJ data[i] data i data[i] = tmp data[i] data i tmp return ret; ret int[] data data public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] data = new int[n];

        for (int i = 0; i < n; ++i) {
            data[i] = scanner.nextInt();
        }

        int cnt = selectSort(data);
        for (int i = 0; i < n; ++i) {
            System.out.print(data[i]);
            if (i != n - 1) System.out.print(" ");
        }
        System.out.println();
        System.out.println(cnt);
    } main {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] data = new int[n];

        for (int i = 0; i < n; ++i) {
            data[i] = scanner.nextInt();
        }

        int cnt = selectSort(data);
        for (int i = 0; i < n; ++i) {
            System.out.print(data[i]);
            if (i != n - 1) System.out.print(" ");
        }
        System.out.println();
        System.out.println(cnt);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] data = new int[n]; data new int[n] n for (int i = 0; i < n; ++i) {
            data[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
            data[i] = scanner.nextInt();
        } {
            data[i] = scanner.nextInt();
        } data[i] = scanner.nextInt() data[i] data i scanner.nextInt() scanner.nextInt scanner int cnt = selectSort(data); cnt selectSort(data) selectSort data for (int i = 0; i < n; ++i) {
            System.out.print(data[i]);
            if (i != n - 1) System.out.print(" ");
        } int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
            System.out.print(data[i]);
            if (i != n - 1) System.out.print(" ");
        } {
            System.out.print(data[i]);
            if (i != n - 1) System.out.print(" ");
        } System.out.print(data[i]) System.out.print System.out System System.out data[i] data i if (i != n - 1) System.out.print(" "); i != n - 1 i n - 1 n 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
    static int selectSort(int[] data) {
        int ret = 0, n = data.length;
        for (int i = 0; i < n; ++i) {
            int minJ = i;
            for (int j = i; j < n; ++j) {
                if (data[j] < data[minJ]) minJ = j;
            }
            if(minJ != i) {
                ++ret;
                int tmp = data[minJ];
                data[minJ] = data[i];
                data[i] = tmp;
            }
        }
        return ret;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] data = new int[n];

        for (int i = 0; i < n; ++i) {
            data[i] = scanner.nextInt();
        }

        int cnt = selectSort(data);
        for (int i = 0; i < n; ++i) {
            System.out.print(data[i]);
            if (i != n - 1) System.out.print(" ");
        }
        System.out.println();
        System.out.println(cnt);
    }
} public class Main {
    static int selectSort(int[] data) {
        int ret = 0, n = data.length;
        for (int i = 0; i < n; ++i) {
            int minJ = i;
            for (int j = i; j < n; ++j) {
                if (data[j] < data[minJ]) minJ = j;
            }
            if(minJ != i) {
                ++ret;
                int tmp = data[minJ];
                data[minJ] = data[i];
                data[i] = tmp;
            }
        }
        return ret;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] data = new int[n];

        for (int i = 0; i < n; ++i) {
            data[i] = scanner.nextInt();
        }

        int cnt = selectSort(data);
        for (int i = 0; i < n; ++i) {
            System.out.print(data[i]);
            if (i != n - 1) System.out.print(" ");
        }
        System.out.println();
        System.out.println(cnt);
    }
} Main
import java.util.Scanner;

public class Main {
    static int selectSort(int[] data) {
        int ret = 0, n = data.length;
        for (int i = 0; i < n; ++i) {
            int minJ = i;
            for (int j = i; j < n; ++j) {
                if (data[j] < data[minJ]) minJ = j;
            }
            if(minJ != i) {
                ++ret;
                int tmp = data[minJ];
                data[minJ] = data[i];
                data[i] = tmp;
            }
        }
        return ret;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] data = new int[n];

        for (int i = 0; i < n; ++i) {
            data[i] = scanner.nextInt();
        }

        int cnt = selectSort(data);
        for (int i = 0; i < n; ++i) {
            System.out.print(data[i]);
            if (i != n - 1) System.out.print(" ");
        }
        System.out.println();
        System.out.println(cnt);
    }
}
