let R() = stdin.ReadLine() let N = R() |> int let A = R().Split() |> Array.map (int >> fun x -> x - 1) |> Array.sort let ans = A |> Array.indexed |> Array.fold (fun acc (idx,value) -> acc + abs(idx - value)) 0 ans |> printfn "%i"