def main(): n = int(input()) l = sorted(list(map(int, input().split()))) ans = 10 ** 10 for i in range(len(l) - 1): if l[i] == l[i + 1]: continue ans = min(ans, abs(l[i] - l[i + 1])) print(ans if ans != 10 ** 10 else 0) if __name__ == '__main__': main()