package yukicoder; import java.util.Arrays; import java.util.Scanner; import org.omg.PortableInterceptor.Interceptor; public class Yuki135 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int x[] = new int[n]; for (int i = 0; i < n; i++) { x[i] = scan.nextInt(); } scan.close(); Arrays.sort(x); int ans = 0; int ans2 = 0; for (int i = 0; i < n-1; i++) { if(x[i] != 0){ if (x[i + 1] > x[i]) { ans = x[i + 1] - x[i]; } else if(x[i + 1] < x[i]){ ans = x[i] - x[i + 1]; } else if(x[i + 1] == x[i]){ ans = x[i]; } if(ans2 == 0){ ans2 = ans; }else if(ans2 > ans && ans != 0){ ans2 = ans; } } } System.out.println(ans2); /* * int ans = 0; int perseAns = 0; for(int i = 0; i < n; i++) { for(int j * = 0; j < n; j++) { * * if( x[i] > x[j] ){ ans = x[i]-x[j]; } else { ans = x[j]-x[i]; } * * if(perseAns == 0) { perseAns = ans; }else if ( ans < perseAns && ans * != 0) { perseAns = ans; } } } System.out.println(perseAns); */ } }