#include <bits/stdc++.h>
int main() {
  int N, A[100], cnt = 0;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  for (int i = 0; i <= N - 1; i++) {
    int minj = i;
    for (int j = i; j <= N - 1; j++) {
      if (A[j] < A[minj]) {
        minj = j;
      }
    }
    if (i != minj) {
      int a = A[i];
      A[minj] = A[i];
      A[minj] = a;
      cnt++;
    }
  }
  for (int i = 0; i < N - 1; i++) {
    scanf("%d ", A[i]);
  }
  printf("%d\n%d\n", A[N - 1], cnt);
}
