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