def input_number():
    num = raw_input()
    array = num.strip().split(" ")
    int_array = map(int, array)

    return int_array


def main():
    n = raw_input()
    count = 0
    int_array = input_number()
    for i in range(int(n)):
        minj = i
        for j in range(i, int(n)):
            if int_array[j] < int_array[minj]:
                minj = j
        v = int_array[i]
        int_array[i] = int_array[minj]
        int_array[minj] = v
        if minj != i:
            count += 1
    array = map(str, int_array)
    print " ".join(array)
    print count


if __name__ == '__main__':
    main() def input_number():
    num = raw_input()
    array = num.strip().split(" ")
    int_array = map(int, array)

    return int_array input_number num = raw_input() num raw_input() raw_input array = num.strip().split(" ") array num.strip().split(" ") num.strip().split num.strip() num.strip num strip split " " int_array = map(int, array) int_array map(int, array) map int array return int_array int_array def main():
    n = raw_input()
    count = 0
    int_array = input_number()
    for i in range(int(n)):
        minj = i
        for j in range(i, int(n)):
            if int_array[j] < int_array[minj]:
                minj = j
        v = int_array[i]
        int_array[i] = int_array[minj]
        int_array[minj] = v
        if minj != i:
            count += 1
    array = map(str, int_array)
    print " ".join(array)
    print count main n = raw_input() n raw_input() raw_input count = 0 count 0 int_array = input_number() int_array input_number() input_number for i in range(int(n)):
        minj = i
        for j in range(i, int(n)):
            if int_array[j] < int_array[minj]:
                minj = j
        v = int_array[i]
        int_array[i] = int_array[minj]
        int_array[minj] = v
        if minj != i:
            count += 1
     i range(int(n)) range int(n) int n minj = i minj i for j in range(i, int(n)):
            if int_array[j] < int_array[minj]:
                minj = j
         j range(i, int(n)) range i int(n) int n if int_array[j] < int_array[minj]:
                minj = j
         int_array[j] < int_array[minj] int_array[j] int_array j int_array[minj] int_array minj minj = j minj j v = int_array[i] v int_array[i] int_array i int_array[i] = int_array[minj] int_array[i] int_array i int_array[minj] int_array minj int_array[minj] = v int_array[minj] int_array minj v if minj != i:
            count += 1
     minj != i minj i count += 1 count 1 array = map(str, int_array) array map(str, int_array) map str int_array print " ".join(array) " ".join " " join array print if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    n = raw_input()
    count = 0
    int_array = input_number()
    for i in range(int(n)):
        minj = i
        for j in range(i, int(n)):
            if int_array[j] < int_array[minj]:
                minj = j
        v = int_array[i]
        int_array[i] = int_array[minj]
        int_array[minj] = v
        if minj != i:
            count += 1
    array = map(str, int_array)
    print " ".join(array)
    print count def main():
    n = raw_input()
    count = 0
    int_array = input_number()
    for i in range(int(n)):
        minj = i
        for j in range(i, int(n)):
            if int_array[j] < int_array[minj]:
                minj = j
        v = int_array[i]
        int_array[i] = int_array[minj]
        int_array[minj] = v
        if minj != i:
            count += 1
    array = map(str, int_array)
    print " ".join(array)
    print count main def input_number():
    num = raw_input()
    array = num.strip().split(" ")
    int_array = map(int, array)

    return int_array def input_number():
    num = raw_input()
    array = num.strip().split(" ")
    int_array = map(int, array)

    return int_array input_number
def input_number():
    num = raw_input()
    array = num.strip().split(" ")
    int_array = map(int, array)

    return int_array


def main():
    n = raw_input()
    count = 0
    int_array = input_number()
    for i in range(int(n)):
        minj = i
        for j in range(i, int(n)):
            if int_array[j] < int_array[minj]:
                minj = j
        v = int_array[i]
        int_array[i] = int_array[minj]
        int_array[minj] = v
        if minj != i:
            count += 1
    array = map(str, int_array)
    print " ".join(array)
    print count


if __name__ == '__main__':
    main()