def main(): num = int(input()) values = map(int, input().split()) set_values = set(values) sorted_values = sorted(list(set_values)) min_difference = 0 for i in range(len(sorted_values) - 1): difference = abs(sorted_values[i+1] - sorted_values[i]) if min_difference == 0 or difference < min_difference: min_difference = difference print(min_difference) if __name__ == '__main__': main()