fn print_vec(arr: &Vec<u32>) {
    for i in 0..arr.len() {
        print!("{}", arr[i]);
        if i < arr.len() - 1 {
            print!(" ");
        }
    }
}
fn selection_sort(arr: &Vec<u32>, _n: u32) -> Vec<u32> {
    let mut sorted = arr.to_vec();
    let mut n_swap = 0;
    for i in 0..sorted.len() {
        let mut min_value = arr[i];
        let mut min_index = i;
        for j in i..sorted.len() {
            if sorted[j] < min_value {
                min_value = sorted[j];
                min_index = j;
            }
        }

        if sorted[min_index] != sorted[i] {
            n_swap += 1;
            sorted[min_index] = sorted[i];
            sorted[i] = min_value;
        }
    }
    print_vec(&sorted);
    println!("\n{}", n_swap);

    sorted
}

fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();
    let n: u32 = line.trim().parse().ok().unwrap();

    line.clear();
    std::io::stdin().read_line(&mut line).ok();
    let arr = line.split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect();

    selection_sort(&arr, n);
}

