Given an array a1, a2, ..., an of n integers, find the largest number in the array that is not a perfect square.

A number x is said to be a perfect square if there exists an integer y such that x = y2.

Input

The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of elements in the array.

The second line contains n integers a1, a2, ..., an ( - 106 ≤ ai ≤ 106) — the elements of the array.

It is guaranteed that at least one element of the array is not a perfect square.

Output

Print the largest number in the array which is not a perfect square. It is guaranteed that an answer always exists.

Examples

Input

2
4 2


Output

2


Input

8
1 2 4 8 16 32 64 576


Output

32

Note

In the first sample case, 4 is a perfect square, so the largest number in the array that is not a perfect square is 2.

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] tab = in.nextArrayInt(n);
        Arrays.sort(tab);
        for (int i = tab.length-1; i >-1; i--) {
            int q = (int) Math.sqrt(tab[i]);
            if (q*q!=tab[i]){
                out.println(tab[i]);
                out.close();
                return;
            }
        }
        out.close();
    }

    public static long Cn2(long n) {
        return n * (n - 1) / 2;
    }

    public static int ceilLog2(double n) {
        return (int) Math.ceil(Math.log(n) / Math.log(2));
    }

    public static ArrayList<Long> listCh = new ArrayList<>();

    public static String[] tabCh = {"4", "7"};

    public static void permutLucky(int i, String ch) {
        if (i == 11) {
            return;
        }
        for (int j = 0; j < tabCh.length; j++) {
            String string = ch + tabCh[j];
            listCh.add(Long.valueOf(string));
            permutLucky(i + 1, string);
        }
    }

    public static int sumTable(int[] tab, int indx) {
        if (indx == tab.length) {
            return 0;
        }
        return tab[indx] + sumTable(tab, indx + 1);
    }

    public static List<int[]> list = new LinkedList<>();

    public static void Permute(int[] input, int startindex) {
        int size = input.length;
        if (size == startindex + 1) {
            int[] tab = new int[size];
            for (int i = 0; i < tab.length; i++) {
                tab[i] = input[i];
            }
            list.add(tab);
        } else {
            for (int i = startindex; i < size; i++) {
                int temp = input[i];
                input[i] = input[startindex];
                input[startindex] = temp;
                Permute(input, startindex + 1);
                int temp2 = input[i];
                input[i] = input[startindex];
                input[startindex] = temp2;
            }
        }
    }

    public static int[] radixSort(int[] f) {
        return radixSort(f, f.length);
    }

    public static int[] radixSort(int[] f, int n) {
        int[] to = new int[n];
        {
            int[] b = new int[65537];
            for (int i = 0; i < n; i++) {
                b[1 + (f[i] & 0xffff)]++;
            }
            for (int i = 1; i <= 65536; i++) {
                b[i] += b[i - 1];
            }
            for (int i = 0; i < n; i++) {
                to[b[f[i] & 0xffff]++] = f[i];
            }
            int[] d = f;
            f = to;
            to = d;
        }
        {
            int[] b = new int[65537];
            for (int i = 0; i < n; i++) {
                b[1 + (f[i] >>> 16)]++;
            }
            for (int i = 1; i <= 65536; i++) {
                b[i] += b[i - 1];
            }
            for (int i = 0; i < n; i++) {
                to[b[f[i] >>> 16]++] = f[i];
            }
            int[] d = f;
            f = to;
            to = d;
        }
        return f;

    }

    private static class FastScanner {

        private final InputStream stream;
        private final byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        public FastScanner(File source) throws FileNotFoundException {
            this.stream = new FileInputStream(source);
        }

        int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        boolean isEndline(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

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

        public int[] nextArrayInt(int n) {
            int tab[] = new int[n];
            for (int i = 0; i < n; i++) {
                tab[i] = nextInt();
            }
            return tab;
        }

        public String[] nextArrayString(int n) {
            String tab[] = new String[n];
            for (int i = 0; i < n; i++) {
                tab[i] = next();
            }
            return tab;
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String next() {
            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 (isEndline(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndline(c));
            return res.toString();
        }
    }

    static class IntegerPair implements Comparable {

        Integer _first, _second;

        public IntegerPair(Integer f, Integer s) {
            _first = f;
            _second = s;
        }

        public int compareTo(Object o) {
            if (this.first() != ((IntegerPair) o).first()) {
                return this.first() - ((IntegerPair) o).first();
            } else {
                return this.second() - ((IntegerPair) o).second();
            }
        }

        Integer first() {
            return _first;
        }

        Integer second() {
            return _second;
        }

        @Override
        public String toString() {
            return "IntegerPair{" + "_first=" + _first + ", _second=" + _second + '}';
        }

    }

    static class IntegerTriple implements Comparable {

        Integer _first, _second, _third;

        public IntegerTriple(Integer f, Integer s, Integer t) {
            _first = f;
            _second = s;
            _third = t;
        }

        public int compareTo(Object o) {
            if (!this.first().equals(((IntegerTriple) o).first())) {
                return this.first() - ((IntegerTriple) o).first();
            } else if (!this.second().equals(((IntegerTriple) o).second())) {
                return this.second() - ((IntegerTriple) o).second();
            } else {
                return this.third() - ((IntegerTriple) o).third();
            }
        }

        Integer first() {
            return _first;
        }

        Integer second() {
            return _second;
        }

        Integer third() {
            return _third;
        }

        @Override
        public String toString() {
            return "IntegerTriple{" + "_first=" + _first + ", _second=" + _second + ", _third=" + _third + '}';
        }

    }
}
