#!/bin/python3 import sys n = int(input().strip()) a = list(map(int, input().strip().split(' '))) s = sorted(a) diff = s[1] - s[0] for i in range(len(s) - 1): new_diff = s[i + 1] - s[i] if new_diff == 0: print(0) sys.exit() else: if new_diff < diff: diff = new_diff print(diff) # your code goes here