For this Question: Bob has N integers. He will divide these integers into three <b>non- empty</b> sets S1, S2 and S3.
After that bob will take one integer from each set X1, X2 and X3. It can be any integer of the set.

Variation of the distribution of integer is defined as 
V = | X1 - X2 | + | X2 - X3 | 

What is the best way to distribute integers in three sets so that variation is minimum? 
Print the minimum variation of any Integer distribution.First line contains N.
Next line contains N space separated integers.

<b>Constraints</b>
3 &le; N &le; 10<sup>5</sup>
1 &le; arr[i] &le; 10<sup>9</sup>Output a single integer denoting the minimum possible variation of an integer distribution.Input:
5
3 1 5 2 3

Output:
1

Explanation:
S1 => 2 5 => say X1 = 2
S2 => 1 3 => say X2 = 3
S3 => 3 => say X3 = 3
V = |X1 - X2| + |X2 - X3| = |2 - 3| + |3-3| = 1, I have written this Solution Code: import java.io.*;
import java.util.*;



public class Main {
     
    public static void main(String[] args) {
        
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        
        int n=Integer.parseInt(in.next());
        int a[] = new int[n];
        for(int i=0;i<n;i++){
            a[i]=Integer.parseInt(in.next());
        }
        
        Arrays.sort(a);
        int ans=(a[1]-a[0]) + (a[2]-a[1]);
        for(int i=2;i+1<n;i++){
            ans=Math.min(ans ,(a[i] - a[i-1]) + (a[i+1]-a[i]));
        }
        out.print(ans);
        out.close();
    }

    
    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}
, In this Programming Language: Java, Now tell me if this Code is compilable or not?