output_description: Print the maximum possible sum of the absolute differences between the
  adjacent elements after arranging the given integers in a row in any order you
  like.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1
      :
      A_N
attempt: # input n
  n = int(input())
  
  # input a(n times)
  a = list()
  for idx in range(n):
      a.append(int(input()))
  
  #
  a.sort()
  
  # Init
  b = [0] * n
  
  # Calc center
  idx = int((n / 2) + 0.5) - 1
  b[idx] = a[0]
  
  incr = 1
  pflg = False
  
  maxidx = n - 1
  minidx = 1
  mflg = False
  
  for loopidx in range(n - 1):
      if mflg == False:
          if pflg == False:
              b[idx + incr] = a[maxidx]
              pflg = True
          else:
              b[idx - incr] = a[maxidx]
              pflg = False
              mflg = True
              incr = incr + 1
          maxidx = maxidx - 1
      else:
          if pflg == False:
              b[idx + incr] = a[minidx]
              pflg = True
          else:
              b[idx - incr] = a[minidx]
              pflg = False
              mflg = False
              incr = incr + 1
          minidx = minidx + 1
  
  # Sum & Output
  sum = 0
  for idx in range(n - 1):
      sum = sum + (abs(b[idx] - b[idx + 1]))
  
  print(sum)
  
problem_description: Statement
  
  You are given N integers; the i-th of them is A_i. Find the maximum possible
  sum of the absolute differences between the adjacent elements after arranging
  these integers in a row in any order you like.
samples: [{"input": "5\n    6\n    8\n    1\n    2\n    3", "output": "21\n    \n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute\ndifferences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6\n- 2| = 21. This is the maximum possible sum.\n\n* * *"}, {"input": "6\n    3\n    1\n    4\n    1\n    5\n    9", "output": "25\n    \n\n* * *"}, {"input": "3\n    5\n    5\n    1", "output": "8"}]