#!/bin/python3 import sys seen_numbers = set() found = False smallest = None n = int(input().strip()) for i in map(int, input().strip().split(' ')): if i in seen_numbers: print('0') found = True break seen_numbers.add(i) if not found: sorted_list = sorted(seen_numbers) for i in range(len(sorted_list)-1): small = abs(sorted_list[i]-sorted_list[i+1]) if smallest == None: smallest = small elif small < smallest: smallest = small print(smallest)