def selections(N):
    count = 0
    for i in range(len(N)):
        mini = i
        for j in range(i+1, len(N)):
            if N[mini] > N[j]:
                mini = j
        if i != mini:
            N[mini], N[i] = N[i], N[mini]
            count += 1
    for n in N:
        print(str(n)+' ', end='')
    print('')
    print(count)

n = int(input())
numbers = list(map(int, input().split()))

selections(numbers)