n = gets.to_i a = gets.split.map(&:to_i).sort ans = 0 n.times do |i| ans += (a[i] - i-1).abs end p ans