import java.util.Scanner;

public class Main{
    Main(){
    Scanner sc = new Scanner(System.in);
    int n, t, s, cnt;
    int[] a;
 
    while(sc.hasNext()){
        n = sc.nextInt();
 
        a = new int[n];
        for(int i = 0; i < n; ++i)
        a[i] = sc.nextInt();
 
        cnt = 0;
        for(int i = 0; i < n; ++i){
        t = i;
        for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j;
 
        if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        }
        }
 
        for(int i = 0; i < n-1; ++i)
        System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
    }
 
    public static void main(String[] args){
    new Main();
    }
} import java.util.Scanner; Scanner java.util public class Main{
    Main(){
    Scanner sc = new Scanner(System.in);
    int n, t, s, cnt;
    int[] a;
 
    while(sc.hasNext()){
        n = sc.nextInt();
 
        a = new int[n];
        for(int i = 0; i < n; ++i)
        a[i] = sc.nextInt();
 
        cnt = 0;
        for(int i = 0; i < n; ++i){
        t = i;
        for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j;
 
        if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        }
        }
 
        for(int i = 0; i < n-1; ++i)
        System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
    }
 
    public static void main(String[] args){
    new Main();
    }
} Main Main(){
    Scanner sc = new Scanner(System.in);
    int n, t, s, cnt;
    int[] a;
 
    while(sc.hasNext()){
        n = sc.nextInt();
 
        a = new int[n];
        for(int i = 0; i < n; ++i)
        a[i] = sc.nextInt();
 
        cnt = 0;
        for(int i = 0; i < n; ++i){
        t = i;
        for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j;
 
        if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        }
        }
 
        for(int i = 0; i < n-1; ++i)
        System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
    } Main {
    Scanner sc = new Scanner(System.in);
    int n, t, s, cnt;
    int[] a;
 
    while(sc.hasNext()){
        n = sc.nextInt();
 
        a = new int[n];
        for(int i = 0; i < n; ++i)
        a[i] = sc.nextInt();
 
        cnt = 0;
        for(int i = 0; i < n; ++i){
        t = i;
        for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j;
 
        if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        }
        }
 
        for(int i = 0; i < n-1; ++i)
        System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n n t t s s cnt; cnt int[] a; a while(sc.hasNext()){
        n = sc.nextInt();
 
        a = new int[n];
        for(int i = 0; i < n; ++i)
        a[i] = sc.nextInt();
 
        cnt = 0;
        for(int i = 0; i < n; ++i){
        t = i;
        for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j;
 
        if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        }
        }
 
        for(int i = 0; i < n-1; ++i)
        System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    } sc.hasNext() sc.hasNext sc {
        n = sc.nextInt();
 
        a = new int[n];
        for(int i = 0; i < n; ++i)
        a[i] = sc.nextInt();
 
        cnt = 0;
        for(int i = 0; i < n; ++i){
        t = i;
        for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j;
 
        if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        }
        }
 
        for(int i = 0; i < n-1; ++i)
        System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    } n = sc.nextInt() n sc.nextInt() sc.nextInt sc 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 cnt = 0 cnt 0 for(int i = 0; i < n; ++i){
        t = i;
        for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j;
 
        if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        }
        } int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
        t = i;
        for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j;
 
        if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        }
        } {
        t = i;
        for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j;
 
        if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        }
        } t = i t i for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j; int j = i; int j = i; j i j < n j n ++j ++j j if(a[j] < a[t]) t = j; if(a[j] < a[t]) t = j; a[j] < a[t] a[j] a j a[t] a t t = j t j if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        } a[t] != a[i] a[t] a t a[i] a i {
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        } s = a[i] s a[i] a i a[i] = a[t] a[i] a i a[t] a t a[t] = s a[t] a t s ++cnt cnt 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 System.out System System.out "%d " a[i] a i 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(cnt) System.out.println System.out System System.out cnt public static void main(String[] args){
    new Main();
    } main {
    new Main();
    } new Main() String[] args args public class Main{
    Main(){
    Scanner sc = new Scanner(System.in);
    int n, t, s, cnt;
    int[] a;
 
    while(sc.hasNext()){
        n = sc.nextInt();
 
        a = new int[n];
        for(int i = 0; i < n; ++i)
        a[i] = sc.nextInt();
 
        cnt = 0;
        for(int i = 0; i < n; ++i){
        t = i;
        for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j;
 
        if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        }
        }
 
        for(int i = 0; i < n-1; ++i)
        System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
    }
 
    public static void main(String[] args){
    new Main();
    }
} public class Main{
    Main(){
    Scanner sc = new Scanner(System.in);
    int n, t, s, cnt;
    int[] a;
 
    while(sc.hasNext()){
        n = sc.nextInt();
 
        a = new int[n];
        for(int i = 0; i < n; ++i)
        a[i] = sc.nextInt();
 
        cnt = 0;
        for(int i = 0; i < n; ++i){
        t = i;
        for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j;
 
        if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        }
        }
 
        for(int i = 0; i < n-1; ++i)
        System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
    }
 
    public static void main(String[] args){
    new Main();
    }
} Main
import java.util.Scanner;

public class Main{
    Main(){
    Scanner sc = new Scanner(System.in);
    int n, t, s, cnt;
    int[] a;
 
    while(sc.hasNext()){
        n = sc.nextInt();
 
        a = new int[n];
        for(int i = 0; i < n; ++i)
        a[i] = sc.nextInt();
 
        cnt = 0;
        for(int i = 0; i < n; ++i){
        t = i;
        for(int j = i; j < n; ++j)
            if(a[j] < a[t]) t = j;
 
        if(a[t] != a[i]){
            s = a[i];
            a[i] = a[t];
            a[t] = s;
            ++cnt;
        }
        }
 
        for(int i = 0; i < n-1; ++i)
        System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
    }
 
    public static void main(String[] args){
    new Main();
    }
}
