n = int(input())
a = list(map(int,input()))
c = 0
min = 9
for i in range(0,n):
    minj = i
    for j in range(i+1,n):
        if a[j] < a[minj]:
            minj = j
    a[i],a[minj] = a[minj],a[i]
    c += 1
    
print(*a)
print(c)
