text: #!/bin/python3
  
  import math
  import os
  import random
  import re
  import sys
  
  # Complete the minimumAbsoluteDifference function below.
  def minimumAbsoluteDifference(arr):
      arr.sort()
      minDifference = 10**20
      for i in range(len(arr)):
          minDifference = min(abs(arr[i]-arr[i-1]), minDifference)
      return (minDifference)
  if __name__ == '__main__':
      fptr = open(os.environ['OUTPUT_PATH'], 'w')
  
      n = int(input())
  
      arr = list(map(int, input().rstrip().split()))
  
      result = minimumAbsoluteDifference(arr)
  
      fptr.write(str(result) + '\n')
  
      fptr.close()
  