input() nums = map(int, input().split()) nums = list(set(nums)) nums.sort() ans = [] if(len(nums) < 2): print('0') else: for i in range(len(nums)-1): ans.append(nums[i+1] - nums[i]) print(min(ans))