N = gets.to_i A = gets.split.map(&:to_i).sort ans = A.each_with_index.inject(0) do |sum,(v,i)| sum + (v - (i + 1)).abs end puts ans