if __name__ == '__main__':
    n = int(raw_input())
    A = map(int, raw_input().split())
    cnt = 0
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[minj], A[i] = A[i], A[minj]
            cnt += 1
    for x in A:
        print x,
    print
    print cnt
