N=gets;p gets.split.map(&:to_i).sort.each.with_index(1).map(&:-).map(&:abs).sum