N,A=$<.map{|l|l.split.map(&:to_i).sort} puts A.each.with_index(1).map(&:-).map(&:abs).sum