def main():
    tmp = input()
    ls = list(map(int, input().split(' ')))
    count = 0
    
    for i in range(len(ls)):
        minj = i
        
        for j in range(i, len(ls)):
            if ls[j] < ls[minj]:
                minj = j
        ls[i], ls[minj] = ls[minj], ls[i]

        if minj != i:
            count += 1

    print(' '.join(map(str,ls)))
    print(count)
    
if __name__ == '__main__':
    main() def main():
    tmp = input()
    ls = list(map(int, input().split(' ')))
    count = 0
    
    for i in range(len(ls)):
        minj = i
        
        for j in range(i, len(ls)):
            if ls[j] < ls[minj]:
                minj = j
        ls[i], ls[minj] = ls[minj], ls[i]

        if minj != i:
            count += 1

    print(' '.join(map(str,ls)))
    print(count)
     main tmp = input() tmp input() input ls = list(map(int, input().split(' '))) ls list(map(int, input().split(' '))) list map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' count = 0 count 0 for i in range(len(ls)):
        minj = i
        
        for j in range(i, len(ls)):
            if ls[j] < ls[minj]:
                minj = j
        ls[i], ls[minj] = ls[minj], ls[i]

        if minj != i:
            count += 1

     i range(len(ls)) range len(ls) len ls minj = i minj i for j in range(i, len(ls)):
            if ls[j] < ls[minj]:
                minj = j
         j range(i, len(ls)) range i len(ls) len ls if ls[j] < ls[minj]:
                minj = j
         ls[j] < ls[minj] ls[j] ls j ls[minj] ls minj minj = j minj j ls[i], ls[minj] = ls[minj], ls[i] ls[i] ls i ls[minj] ls minj ls[minj] ls minj ls[i] ls i if minj != i:
            count += 1

     minj != i minj i count += 1 count 1 print(' '.join(map(str,ls))) print ' '.join(map(str,ls)) ' '.join ' ' join map(str,ls) map str ls print(count) print count if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    tmp = input()
    ls = list(map(int, input().split(' ')))
    count = 0
    
    for i in range(len(ls)):
        minj = i
        
        for j in range(i, len(ls)):
            if ls[j] < ls[minj]:
                minj = j
        ls[i], ls[minj] = ls[minj], ls[i]

        if minj != i:
            count += 1

    print(' '.join(map(str,ls)))
    print(count)
     def main():
    tmp = input()
    ls = list(map(int, input().split(' ')))
    count = 0
    
    for i in range(len(ls)):
        minj = i
        
        for j in range(i, len(ls)):
            if ls[j] < ls[minj]:
                minj = j
        ls[i], ls[minj] = ls[minj], ls[i]

        if minj != i:
            count += 1

    print(' '.join(map(str,ls)))
    print(count)
     main
def main():
    tmp = input()
    ls = list(map(int, input().split(' ')))
    count = 0
    
    for i in range(len(ls)):
        minj = i
        
        for j in range(i, len(ls)):
            if ls[j] < ls[minj]:
                minj = j
        ls[i], ls[minj] = ls[minj], ls[i]

        if minj != i:
            count += 1

    print(' '.join(map(str,ls)))
    print(count)
    
if __name__ == '__main__':
    main()