#!/bin/python3 if __name__ == '__main__': input() # Ignore the first line xs = sorted(int(i) for i in input().split()) result = min(j - i for i, j in zip(xs[:-1], xs[1:])) print(result)