import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private int excludeIndex; public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for(int a_i=0; a_i < n; a_i++){ a[a_i] = in.nextInt(); } // your code goes here int smallest = findSmallest(a); int scndSmallest = findSecondSmallest(a,smallest); System.out.println (Math.abs(scndSmallest)-Math.abs(smallest)); } public static int findSmallest(int[]a){ int curSmallest=a[0]; for (int i : a){ if (curSmallest> Math.abs(i)){ curSmallest=i; } } //System.out.println (curSmallest); return curSmallest; } public static int findSecondSmallest(int[]a,int smallest){ int curScndSmallest=a[0]; for (int i : a){ if (curScndSmallest>Math.abs(i) && Math.abs(i)!=smallest ){ curScndSmallest=i; } } //System.out.println (curScndSmallest); return curScndSmallest; } }