For this Question: Ram has an array a<sub>1</sub>,&nbsp;a<sub>2</sub>,....,&nbsp;a<sub>n</sub>. Ram asks Shyam to choose two integers a<sub>i</sub> and a<sub>j</sub> (i != j) such that the value of bitwise AND of those integers is maximum. Help Shyam to find the maximum value.The first line contains only n, the length of the array.
Second line contains the array elements a<sub>1</sub>, a<sub>2</sub>,. , a<sub>n</sub>separated by space.

<b>Constraints</b>
1 &le; n &le; 3x10<sup>5</sup>
1 &le; a<sub>i</sub> &le; 10<sup>9</sup>The only line of output contains an integer, maximum value value that Shyam can get.Sample Input
4
3 4 2 3
Sample Output
3
Explanation
Shyam can choose a<sub>1</sub> = 3 and a<sub>4</sub> = 3 with bitwise AND 3 which is maximum., I have written this Solution Code: import java.io.*;
import java.util.*;
public class Main {
    final static long mod = 1000000007;
 
    static void debug(Object...args)
    {
        System.out.println(Arrays.deepToString(args));
    }
    static int checkBit(int pattern, int arr[], int n)
    {
        int count = 0;
        for (int i = 0; i < n; i++)
            if ((pattern & arr[i]) == pattern)
                count++;
        return count;
    }
 
 
    static int maxAND (int arr[], int n)
    {
        int res = 0, count;
 
 
        for (int bit = 31; bit >= 0; bit--)
        {
 
            count = checkBit(res | (1 << bit), arr, n);
 
 
            if ( count >= 2 )
                res |= (1 << bit);
        }
 
        return res;
    }
 
    public static void main(String[] args) {
        InputReader sc = new InputReader(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        Random gen = new Random();
        int test = 1;//sc.nextInt();
        while(test-->0) {
            int n = sc.nextInt();
            int [] ar = sc.nextIntArray(n);
            pw.println(maxAND(ar,n));
        }
        pw.flush();
        pw.close();
 
    }
 
    static class Data implements Comparable<Data>{
        int x;
        int y;
 
        public Data (int m, int n) {
            x = m;
            y = n;
        }
        @Override
        public int compareTo(Data o) {
            return y - o.y;
        }
    }
 
    static class InputReader {
 
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
 
        public InputReader(InputStream st) {
            this.stream = st;
        }
 
        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public int[] nextIntArray(int n) {
            int [] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }
        public long[] nextLongArray(int n) {
            long [] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextLong();
            }
            return a;
        }
 
        public static int[] shuffle(int[] a, Random gen)
        { for(int i = 0, n = a.length;i < n;i++)
        { int ind = gen.nextInt(n-i)+i;
            int d = a[i];
            a[i] = a[ind];
            a[ind] = d;
 
        }
            return a;
        }
        public static char[] shuffle(char[] a, Random gen)
        { for(int i = 0, n = a.length;i < n;i++)
        { int ind = gen.nextInt(n-i)+i;
            char d = a[i];
            a[i] = a[ind];
            a[ind] = d;
 
        }
            return a;
        }
 
 
        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
 
        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }
 
        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
 
    }
 
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?