def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0

    for i in range(n):
        tmp = i
        for j in range(i, n):
            if a[j] < a[tmp]:
                tmp = j
        if i != tmp:
            a[i], a[tmp] = a[tmp], a[i]
            ans += 1

    print(*a)
    print(ans)


if __name__ == '__main__':
    main() def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0

    for i in range(n):
        tmp = i
        for j in range(i, n):
            if a[j] < a[tmp]:
                tmp = j
        if i != tmp:
            a[i], a[tmp] = a[tmp], a[i]
            ans += 1

    print(*a)
    print(ans) main n = int(input()) n int(input()) int input() input a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = 0 ans 0 for i in range(n):
        tmp = i
        for j in range(i, n):
            if a[j] < a[tmp]:
                tmp = j
        if i != tmp:
            a[i], a[tmp] = a[tmp], a[i]
            ans += 1

     i range(n) range n tmp = i tmp i for j in range(i, n):
            if a[j] < a[tmp]:
                tmp = j
         j range(i, n) range i n if a[j] < a[tmp]:
                tmp = j
         a[j] < a[tmp] a[j] a j a[tmp] a tmp tmp = j tmp j if i != tmp:
            a[i], a[tmp] = a[tmp], a[i]
            ans += 1

     i != tmp i tmp a[i], a[tmp] = a[tmp], a[i] a[i] a i a[tmp] a tmp a[tmp] a tmp a[i] a i ans += 1 ans 1 print(*a) print *a a print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0

    for i in range(n):
        tmp = i
        for j in range(i, n):
            if a[j] < a[tmp]:
                tmp = j
        if i != tmp:
            a[i], a[tmp] = a[tmp], a[i]
            ans += 1

    print(*a)
    print(ans) def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0

    for i in range(n):
        tmp = i
        for j in range(i, n):
            if a[j] < a[tmp]:
                tmp = j
        if i != tmp:
            a[i], a[tmp] = a[tmp], a[i]
            ans += 1

    print(*a)
    print(ans) main
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0

    for i in range(n):
        tmp = i
        for j in range(i, n):
            if a[j] < a[tmp]:
                tmp = j
        if i != tmp:
            a[i], a[tmp] = a[tmp], a[i]
            ans += 1

    print(*a)
    print(ans)


if __name__ == '__main__':
    main()
