#!/bin/python3 import sys n = int(input().strip()) a = list(map(int, input().strip().split(' '))) # your code goes here # need to make this faster, so sort the array, then take difs between adjacent elems, loglin time a.sort() min_diff = a[1] - a[0] for i in range(len(a)-1): diff = a[i+1] - a[i] if diff < min_diff: min_diff = diff print(min_diff)