print((function (n, s)
	local a,r={},0
	for i=1,n do a[i]=0 end
	for e in s:gmatch("%d+") do e=tonumber(e) a[e]=a[e]+1 end
	for i=1,n do
		if a[i]==0 then
			for j=1,n do
				if a[j]>1 then a[i],a[j],r=1,a[j]-1,r+math.abs(i-j) break end
			end
		end
	end
	return r
end)(io.stdin:read("*l"), io.stdin:read("*l")))