if __name__ == "__main__":
    n = int(input().strip())
    arr = [int(i) for i in input().strip().split()]
    s1 = [i for i in range(1, n + 1, 2)]
    s2 = [i for i in range(2, n + 1, 2)]
    su1, su2 = 0, 0
    for i in range(len(arr)):
        su1 += abs(s1[i] - arr[i])
        su2 += abs(s1[i] - arr[i])
    print(min(su1, su2))
