#!/bin/python import sys n = int(raw_input().strip()) a = map(int, raw_input().strip().split(' ')) s = sorted(a) smallest = float("inf") for i in range(len(s) - 1): curr = abs(s[i] - s[i+1]) if curr < smallest: smallest = curr print smallest