import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Data.Char
import Data.List

main = do
    n <- readLn :: IO Int
    xs <- VU.fromList . sort . VU.toList .  (VU.zipWith (-) (VU.fromList [1..n])) . VU.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
    let y = xs VU.! (n `quot` 2)
    print $ VU.foldl' (\a x -> a + (abs $ x-y)) 0 xs