#!/usr/bin/evn perl use strict; use warnings; my $n = <>; my $x = <>; chomp $x; my @array = split / /, $x; @array = sort {$a <=> $b} @array; my @after; my $j = 0; $after[0] = $array[0]; for(my $i = 1; $i < $n; $i++) { if($after[$j] != $array[$i]) { $j++; $after[$j] = $array[$i]; } } my $ans; if($#after >= 1) { $ans = $after[1] - $after[0]; for(my $i = 0; $i < $#after; $i++) { if($after[$i + 1] - $after[$i] < $ans) { $ans = $after[$i + 1] - $after[$i]; } } } else { $ans = 0; } print "$ans\n"; exit;