#!/usr/bin/perl use strict; use warnings; my $n = <>; my $str = <>; chomp $str; my @array = split / /, $str; @array = sort {$a <=> $b} @array; my $i = 1; my $min; my $flag = 0; while($flag == 0) { $min = $array[$i] - $array[$i -1]; $i++; if($min != 0) { $flag = 1; $i--; } } for(my $j = $i; $j < $n; $j++) { my $move = $array[$j] - $array[$j-1]; if(($move != 0)and($move < $min)) { $min = $move; } } print "$min\n"; exit;