output_description: Print the minimum possible sadness of Snuke.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1 A_2 ... A_N
attempt: N = int(input())
  A_list = [int(elem) for elem in input().split(" ")]
  assert len(A_list) == N
  
  modified_A_list = [A - i for i, A in enumerate(A_list, start=1)]
  
  minus_A_list = sorted([A for A in modified_A_list if A < 0])[::-1]
  zero_A_list = [A for A in modified_A_list if A == 0]
  plus_A_list = sorted([A for A in modified_A_list if A > 0])
  # print(minus_A_list, zero_A_list, plus_A_list)
  
  len_minus = len(minus_A_list)
  len_zero = len(zero_A_list)
  len_plus = len(plus_A_list)
  assert len_minus + len_zero + len_plus == N
  current_sum = abs(sum(minus_A_list)) + sum(plus_A_list)
  # print(current_sum)
  
  if len_minus > len_plus + len_zero:
      i = 0
      old_num = 0
      while i < len(minus_A_list):
          current_num = minus_A_list[i]
          current_sum -= abs(current_num - old_num) * (len_minus - len_plus - len_zero)
          # 数の更新
          num_current_val = 0
          while i < len(minus_A_list) and (minus_A_list[i] == current_num):
              i += 1
              num_current_val += 1
          len_minus -= num_current_val
          len_zero_old = len_zero
          len_zero += num_current_val - len_zero_old
          len_plus += len_zero_old
          old_num = current_num
          if len_minus <= len_plus + len_zero:
              break
  
  elif len_plus > len_minus + len_zero:
      i = 0
      old_num = 0
      while i < len(plus_A_list):
          current_num = plus_A_list[i]
          current_sum -= (current_num - old_num) * (len_plus - len_minus - len_zero)
          # 数の更新
          num_current_val = 0
          while i < len(plus_A_list) and plus_A_list[i] == current_num:
              i += 1
              num_current_val += 1
          len_plus -= num_current_val
          len_zero_old = len_zero
          len_zero += num_current_val - len_zero_old
          len_minus += len_zero_old
          old_num = current_num
          if len_plus <= len_minus + len_zero:
              break
  
  print(current_sum)
  
problem_description: Statement
  
  Snuke has an integer sequence A of length N.
  
  He will freely choose an integer b. Here, he will get sad if A_i and b+i are
  far from each other. More specifically, the _sadness_ of Snuke is calculated
  as follows:
  
    * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))
  
  Here, abs(x) is a function that returns the absolute value of x.
  
  Find the minimum possible sadness of Snuke.
samples: [{"input": "5\n    2 2 3 5 5", "output": "2\n    \n\nIf we choose b=0, the sadness of Snuke would be\nabs(2-(0+1))+abs(2-(0+2))+abs(3-(0+3))+abs(5-(0+4))+abs(5-(0+5))=2. Any choice\nof b does not make the sadness of Snuke less than 2, so the answer is 2.\n\n* * *"}, {"input": "9\n    1 2 3 4 5 6 7 8 9", "output": "0\n    \n\n* * *"}, {"input": "6\n    6 5 4 3 2 1", "output": "18\n    \n\n* * *"}, {"input": "7\n    1 1 1 1 2 3 4", "output": "6"}]