n = int(input())
k = [int(i) for i in input().split()]
m = 0


for i in range(n):
    minj = k[i]

    for j in range(i,n):
        if minj > k[j]:
            minj = k[j]
            k[j]=k[i]

        t = k[i]
        k[i] = minj
    if t != minj:
        m += 1



print(' '.join(map(str, k)))
print(m)