from math import *
import random, sys

def nextInt():
	return int(input())
def nextStrs():
	return input().split()
def nextInts():
	return list(map(int,nextStrs()))

def main():
    n = nextInt()
    arr = nextInts()
    
    mk = [0]*101

    res = 10**9+7; cnt = 0
    for i in range(len(arr)):
        if arr[i]%2 == 0:
            continue
        else:
            mk[arr[i]] = 1
    
    for i in range(len(arr)):
        if arr[i]%2 == 0:
            ptr = -1
            for j in range(1,n+1):
                if mk[j] == 0 and j%2 == 1:
                    if ptr == -1 or abs(arr[i]-j) < abs(ptr-j):
                        ptr = j
                        break
            cnt += abs(ptr-arr[i])
            mk[ptr] = 1
        
    res = min(res,cnt)

    mk = [0]*101; cnt = 0

    for i in range(len(arr)):
        if arr[i]%2 == 0:
            mk[arr[i]] = 1
    
    for i in range(len(arr)):
        if arr[i]%2 == 1:
            ptr = -1
            for j in range(1,n+1):
                if mk[j] == 0 and j%2 == 0:
                    if ptr == -1 or abs(arr[i]-j) < abs(ptr-j):
                        ptr = j
                        break
            cnt += abs(ptr-arr[i])
            mk[ptr] = 1

    res = min(res,cnt)

    print(res)
            
if __name__ == "__main__":
    exit(main())