#!/usr/bin/python2
# -*- coding: utf-8 -*-

import sys

def rl(proc=None):
    if proc is not None:
        return proc(sys.stdin.readline())
    else:
        return sys.stdin.readline().rstrip()

def srl(proc=None):
    if proc is not None:
        return map(proc, rl().split())
    else:
        return rl().split()

def main():
    N = rl(int)
    pos = [x-1 for x in sorted(srl(int))]
    targets1 = range(0, N, 2)
    targets2 = range(1, N, 2)
    print min(sum(abs(x-y) for x, y in zip(pos, targets1)),
              sum(abs(x-y) for x, y in zip(pos, targets2)))


if __name__ == '__main__':
    main()
