if __name__ == "__main__":
    n = int(input().rstrip())
    pos = list(map(int, input().rstrip().split()))
    
    ans1 = 0
    ans2 = 0
    for i in range(len(pos)):
        ans1 += abs(2 * (i + 1) - 1 - pos[i])
        
    for i in range(len(pos)):
        ans2 += abs(2 * (i + 1) - pos[i])
        
    print(min(ans1, ans2))