def selectionsort(l,n):
    c=0
    for i in range(n):
        minj=i
        for j in range(i,n):
            if int(l[i])<int(l[minj]):
               minj=j
        l[j],l[minj]=l[minj],l[j]
        c+=1
    print("".join(l))
    print(c)
n=int(input())
l=list(input())
selectionsort(l,n)
