import java.util.Scanner;

public class Main
{
	static int selectionSort(int A[], int n)
	{
		int ret = 0;
		for (int i = 0; i < n; i++)
		{
			int minj = i;
			for (int j = i; j < n; j++)
			{
				if(A[j] < A[minj])
				{
					minj = j;
				}
			}
			if(minj != i)
			{
				int temp = A[i];
				A[i] = A[minj];
				A[minj] = temp;
				++ret;
			}
		}
		return ret;
	}
	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; i++)
		{
			A[i] = sc.nextInt();
		}
		int ans = selectionSort(A, n);
		for (int i = 0; i < n; i++)
		{
			System.out.print(A[i]);
			if(i < n - 1)
			{
				System.out.print(" ");
			}
		}
		System.out.println("\n" + ans);
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main
{
	static int selectionSort(int A[], int n)
	{
		int ret = 0;
		for (int i = 0; i < n; i++)
		{
			int minj = i;
			for (int j = i; j < n; j++)
			{
				if(A[j] < A[minj])
				{
					minj = j;
				}
			}
			if(minj != i)
			{
				int temp = A[i];
				A[i] = A[minj];
				A[minj] = temp;
				++ret;
			}
		}
		return ret;
	}
	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; i++)
		{
			A[i] = sc.nextInt();
		}
		int ans = selectionSort(A, n);
		for (int i = 0; i < n; i++)
		{
			System.out.print(A[i]);
			if(i < n - 1)
			{
				System.out.print(" ");
			}
		}
		System.out.println("\n" + ans);
		sc.close();
	}
} Main static int selectionSort(int A[], int n)
	{
		int ret = 0;
		for (int i = 0; i < n; i++)
		{
			int minj = i;
			for (int j = i; j < n; j++)
			{
				if(A[j] < A[minj])
				{
					minj = j;
				}
			}
			if(minj != i)
			{
				int temp = A[i];
				A[i] = A[minj];
				A[minj] = temp;
				++ret;
			}
		}
		return ret;
	} selectionSort {
		int ret = 0;
		for (int i = 0; i < n; i++)
		{
			int minj = i;
			for (int j = i; j < n; j++)
			{
				if(A[j] < A[minj])
				{
					minj = j;
				}
			}
			if(minj != i)
			{
				int temp = A[i];
				A[i] = A[minj];
				A[minj] = temp;
				++ret;
			}
		}
		return ret;
	} int ret = 0; ret 0 for (int i = 0; i < n; i++)
		{
			int minj = i;
			for (int j = i; j < n; j++)
			{
				if(A[j] < A[minj])
				{
					minj = j;
				}
			}
			if(minj != i)
			{
				int temp = A[i];
				A[i] = A[minj];
				A[minj] = temp;
				++ret;
			}
		} 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(A[j] < A[minj])
				{
					minj = j;
				}
			}
			if(minj != i)
			{
				int temp = A[i];
				A[i] = A[minj];
				A[minj] = temp;
				++ret;
			}
		} {
			int minj = i;
			for (int j = i; j < n; j++)
			{
				if(A[j] < A[minj])
				{
					minj = j;
				}
			}
			if(minj != i)
			{
				int temp = A[i];
				A[i] = A[minj];
				A[minj] = temp;
				++ret;
			}
		} int 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 if(minj != i)
			{
				int temp = A[i];
				A[i] = A[minj];
				A[minj] = temp;
				++ret;
			} minj != i minj i {
				int temp = A[i];
				A[i] = A[minj];
				A[minj] = temp;
				++ret;
			} int temp = A[i]; temp A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = temp A[minj] A minj temp ++ret ret return ret; ret int A[] A int n n 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; i++)
		{
			A[i] = sc.nextInt();
		}
		int ans = selectionSort(A, n);
		for (int i = 0; i < n; i++)
		{
			System.out.print(A[i]);
			if(i < n - 1)
			{
				System.out.print(" ");
			}
		}
		System.out.println("\n" + ans);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int A[] = new int[n];
		for (int i = 0; i < n; i++)
		{
			A[i] = sc.nextInt();
		}
		int ans = selectionSort(A, n);
		for (int i = 0; i < n; i++)
		{
			System.out.print(A[i]);
			if(i < n - 1)
			{
				System.out.print(" ");
			}
		}
		System.out.println("\n" + ans);
		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[] = 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] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc int ans = selectionSort(A, n); ans selectionSort(A, n) selectionSort A n for (int i = 0; i < n; i++)
		{
			System.out.print(A[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(A[i]);
			if(i < n - 1)
			{
				System.out.print(" ");
			}
		} {
			System.out.print(A[i]);
			if(i < n - 1)
			{
				System.out.print(" ");
			}
		} System.out.print(A[i]) System.out.print System.out System System.out A[i] A 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("\n" + ans) System.out.println System.out System System.out "\n" + ans "\n" ans sc.close() sc.close sc String args[] args public class Main
{
	static int selectionSort(int A[], int n)
	{
		int ret = 0;
		for (int i = 0; i < n; i++)
		{
			int minj = i;
			for (int j = i; j < n; j++)
			{
				if(A[j] < A[minj])
				{
					minj = j;
				}
			}
			if(minj != i)
			{
				int temp = A[i];
				A[i] = A[minj];
				A[minj] = temp;
				++ret;
			}
		}
		return ret;
	}
	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; i++)
		{
			A[i] = sc.nextInt();
		}
		int ans = selectionSort(A, n);
		for (int i = 0; i < n; i++)
		{
			System.out.print(A[i]);
			if(i < n - 1)
			{
				System.out.print(" ");
			}
		}
		System.out.println("\n" + ans);
		sc.close();
	}
} public class Main
{
	static int selectionSort(int A[], int n)
	{
		int ret = 0;
		for (int i = 0; i < n; i++)
		{
			int minj = i;
			for (int j = i; j < n; j++)
			{
				if(A[j] < A[minj])
				{
					minj = j;
				}
			}
			if(minj != i)
			{
				int temp = A[i];
				A[i] = A[minj];
				A[minj] = temp;
				++ret;
			}
		}
		return ret;
	}
	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; i++)
		{
			A[i] = sc.nextInt();
		}
		int ans = selectionSort(A, n);
		for (int i = 0; i < n; i++)
		{
			System.out.print(A[i]);
			if(i < n - 1)
			{
				System.out.print(" ");
			}
		}
		System.out.println("\n" + ans);
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main
{
	static int selectionSort(int A[], int n)
	{
		int ret = 0;
		for (int i = 0; i < n; i++)
		{
			int minj = i;
			for (int j = i; j < n; j++)
			{
				if(A[j] < A[minj])
				{
					minj = j;
				}
			}
			if(minj != i)
			{
				int temp = A[i];
				A[i] = A[minj];
				A[minj] = temp;
				++ret;
			}
		}
		return ret;
	}
	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; i++)
		{
			A[i] = sc.nextInt();
		}
		int ans = selectionSort(A, n);
		for (int i = 0; i < n; i++)
		{
			System.out.print(A[i]);
			if(i < n - 1)
			{
				System.out.print(" ");
			}
		}
		System.out.println("\n" + ans);
		sc.close();
	}
}
