import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner cin = new Scanner(System.in);
        int n = Integer.parseInt(cin.next());
        int[] array = new int [n];
        cin.nextLine();
        for (int i = 0; i < n; i++)
        {
            array[i] = cin.nextInt();
        }

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

    // Return count
    public static int selectionSort(int[] A, int N)
    {
        int minj;

        int cnt = 0;
        for (int i = 0; i < N; i++)
        {
            minj = i;
            for (int j = i; j < N; j++)
            {
                if (A[j] < A[minj])
                {
                    minj = j;
                }
            }
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            if (i != minj)
                cnt++;
        }

        return cnt;
    }
} import java.util.Scanner; Scanner java.util public class Main
{
    public static void main(String[] args)
    {
        Scanner cin = new Scanner(System.in);
        int n = Integer.parseInt(cin.next());
        int[] array = new int [n];
        cin.nextLine();
        for (int i = 0; i < n; i++)
        {
            array[i] = cin.nextInt();
        }

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

    // Return count
    public static int selectionSort(int[] A, int N)
    {
        int minj;

        int cnt = 0;
        for (int i = 0; i < N; i++)
        {
            minj = i;
            for (int j = i; j < N; j++)
            {
                if (A[j] < A[minj])
                {
                    minj = j;
                }
            }
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            if (i != minj)
                cnt++;
        }

        return cnt;
    }
} Main public static void main(String[] args)
    {
        Scanner cin = new Scanner(System.in);
        int n = Integer.parseInt(cin.next());
        int[] array = new int [n];
        cin.nextLine();
        for (int i = 0; i < n; i++)
        {
            array[i] = cin.nextInt();
        }

        int cnt = selectionSort(array, n);
        for (int i = 0; i < n; i++)
        {
            System.out.print(array[i]);
            if (i != n - 1)
            {
                System.out.print(" ");
            }
        }
        System.out.println();
        System.out.println(cnt);
    } main {
        Scanner cin = new Scanner(System.in);
        int n = Integer.parseInt(cin.next());
        int[] array = new int [n];
        cin.nextLine();
        for (int i = 0; i < n; i++)
        {
            array[i] = cin.nextInt();
        }

        int cnt = selectionSort(array, n);
        for (int i = 0; i < n; i++)
        {
            System.out.print(array[i]);
            if (i != n - 1)
            {
                System.out.print(" ");
            }
        }
        System.out.println();
        System.out.println(cnt);
    } Scanner cin = new Scanner(System.in); cin new Scanner(System.in) int n = Integer.parseInt(cin.next()); n Integer.parseInt(cin.next()) Integer.parseInt Integer cin.next() cin.next cin int[] array = new int [n]; array new int [n] n cin.nextLine() cin.nextLine cin for (int i = 0; i < n; i++)
        {
            array[i] = cin.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            array[i] = cin.nextInt();
        } {
            array[i] = cin.nextInt();
        } array[i] = cin.nextInt() array[i] array i cin.nextInt() cin.nextInt cin int cnt = selectionSort(array, n); cnt selectionSort(array, n) selectionSort array n for (int i = 0; i < n; i++)
        {
            System.out.print(array[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(array[i]);
            if (i != n - 1)
            {
                System.out.print(" ");
            }
        } {
            System.out.print(array[i]);
            if (i != n - 1)
            {
                System.out.print(" ");
            }
        } System.out.print(array[i]) System.out.print System.out System System.out array[i] array i if (i != n - 1)
            {
                System.out.print(" ");
            } i != n - 1 i n - 1 n 1 {
                System.out.print(" ");
            } 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 // Return count
    public static int selectionSort(int[] A, int N)
    {
        int minj;

        int cnt = 0;
        for (int i = 0; i < N; i++)
        {
            minj = i;
            for (int j = i; j < N; j++)
            {
                if (A[j] < A[minj])
                {
                    minj = j;
                }
            }
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            if (i != minj)
                cnt++;
        }

        return cnt;
    } selectionSort {
        int minj;

        int cnt = 0;
        for (int i = 0; i < N; i++)
        {
            minj = i;
            for (int j = i; j < N; j++)
            {
                if (A[j] < A[minj])
                {
                    minj = j;
                }
            }
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            if (i != minj)
                cnt++;
        }

        return cnt;
    } int minj; minj int cnt = 0; cnt 0 for (int i = 0; i < N; i++)
        {
            minj = i;
            for (int j = i; j < N; j++)
            {
                if (A[j] < A[minj])
                {
                    minj = j;
                }
            }
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            if (i != minj)
                cnt++;
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            minj = i;
            for (int j = i; j < N; j++)
            {
                if (A[j] < A[minj])
                {
                    minj = j;
                }
            }
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            if (i != minj)
                cnt++;
        } {
            minj = i;
            for (int j = i; j < N; j++)
            {
                if (A[j] < A[minj])
                {
                    minj = j;
                }
            }
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            if (i != minj)
                cnt++;
        } 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 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 if (i != minj)
                cnt++; i != minj i minj cnt++ cnt return cnt; cnt int[] A A int N N public class Main
{
    public static void main(String[] args)
    {
        Scanner cin = new Scanner(System.in);
        int n = Integer.parseInt(cin.next());
        int[] array = new int [n];
        cin.nextLine();
        for (int i = 0; i < n; i++)
        {
            array[i] = cin.nextInt();
        }

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

    // Return count
    public static int selectionSort(int[] A, int N)
    {
        int minj;

        int cnt = 0;
        for (int i = 0; i < N; i++)
        {
            minj = i;
            for (int j = i; j < N; j++)
            {
                if (A[j] < A[minj])
                {
                    minj = j;
                }
            }
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            if (i != minj)
                cnt++;
        }

        return cnt;
    }
} public class Main
{
    public static void main(String[] args)
    {
        Scanner cin = new Scanner(System.in);
        int n = Integer.parseInt(cin.next());
        int[] array = new int [n];
        cin.nextLine();
        for (int i = 0; i < n; i++)
        {
            array[i] = cin.nextInt();
        }

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

    // Return count
    public static int selectionSort(int[] A, int N)
    {
        int minj;

        int cnt = 0;
        for (int i = 0; i < N; i++)
        {
            minj = i;
            for (int j = i; j < N; j++)
            {
                if (A[j] < A[minj])
                {
                    minj = j;
                }
            }
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            if (i != minj)
                cnt++;
        }

        return cnt;
    }
} Main
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner cin = new Scanner(System.in);
        int n = Integer.parseInt(cin.next());
        int[] array = new int [n];
        cin.nextLine();
        for (int i = 0; i < n; i++)
        {
            array[i] = cin.nextInt();
        }

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

    // Return count
    public static int selectionSort(int[] A, int N)
    {
        int minj;

        int cnt = 0;
        for (int i = 0; i < N; i++)
        {
            minj = i;
            for (int j = i; j < N; j++)
            {
                if (A[j] < A[minj])
                {
                    minj = j;
                }
            }
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            if (i != minj)
                cnt++;
        }

        return cnt;
    }
}