n = int(input()) x = list(map(int, input().split())) x.sort() ans = float('inf') for i in range(n-1): d = x[i+1] - x[i] if d != 0 and d < ans: ans = d if max(x) == 0: print(0) else: print(ans)