#!/usr/bin/env python3 #fileencoding: utf-8 N = int(input()) X = [int(i) for i in input().strip().split(" ")] dmin = 10e10 for i in range(N-1): for j in range(i+1,N): if X[i] == X[j]: continue tmp = abs(X[i]-X[j]) if tmp > dmin: break else: dmin = abs(X[i]-X[j]) print(dmin)