use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut n: Vec = s.split_whitespace().skip(1).flat_map(str::parse).collect(); n.sort(); println!( "{}", n.iter() .enumerate() .map(|(i, x)| (i as i32 + 1 - x).abs()) .sum::() ) }