package algo; import java.util.ArrayList; import java.util.Scanner; import java.util.*; public class sample7 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); List list = new ArrayList(); for(int i=0; i < N; i++) { list.add(sc.nextInt()); } System.out.println(list.get(N - 1) - list.get(0)); int min = Math.abs(list.get(0) - list.get(1)); for(int i=1; i < N - 1; i++) { min = Math.min(min, Math.abs(list.get(i) - list.get(i+1))); } System.out.println(min); } }