num = gets.chomp.to_i arr = gets.chomp.split.sort.map(&:to_i) ans = [] for i in 1...arr.length ans.push (arr[i] - arr[i-1]).abs unless arr[i] - arr[i-1] == 0 end ans.push 0 if ans.length == 0 ans = ans.sort puts ans[0]