N = input() A = map(int, raw_input().split()) pyramid = range(1, (N/2)+1) + range((N/2)+1, 0, -1) #print A, pyramid dif = [ A[i]-pyramid[i] for i in xrange(N)] #print dif pos = sum( [d for d in dif if d > 0] ) neg = sum( [d for d in dif if d < 0] ) * (-1) cnt = min(pos, neg) + abs(pos - neg) print cnt