while True:

    n = int(eval(input()))

    if n==0: break

    l = list(map(int,input().split()))

    r = []

    for i in range(n):

        for j in range(i+1,n):

            r += [abs(l[i]-l[j])]

    print((min(r)))
while True:

    n = int(eval(input()))

    if n==0: break

    l = sorted(list(map(int,input().split())))

    r = []

    for i in range(n-1):

        r += [l[i+1]-l[i]]

    print((min(r)))
while True:
    n = int(eval(input()))
    if n == 0:
        break
    l = list(map(int, input().split()))
    r = []
    for i in range(n):
        for j in range(i + 1, n):
            r += [abs(l[i] - l[j])]
    print((min(r)))

while True:
    n = int(eval(input()))
    if n == 0:
        break
    l = sorted(list(map(int, input().split())))
    r = []
    for i in range(n - 1):
        r += [l[i + 1] - l[i]]
    print((min(r)))

-    l = list(map(int, input().split())) +    l = sorted(list(map(int, input().split()))) -    for i in range(n): -        for j in range(i + 1, n): -            r += [abs(l[i] - l[j])] +    for i in range(n - 1): +        r += [l[i + 1] - l[i]]