import Data.List main = do e<-getLine e2<-getLine let xs=sort $ map read (words e2)::[Integer] ys=zip [1..] xs ans=foldl (\ acc (a,b) -> acc+a-b) 0 ys putStrLn $ show $ ans