n = int(input()) l = sorted(map(int, input().split())) l2 = [] for i in range(n-1): l2.append(l[i+1] - l[i]) l3 = [] for i in l2: if i != 0: l3.append(i) l4 = [] for i in l3: l4.append(l3.count(i)) if len(set(l4)) == 1: print(min(l3)) else: print(0)