public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(); in.nextLine();
        if (n == 0) {
            System.out.println(n);
            return;
        }
        int betterTemp = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            int temp = in.nextInt();
            if (Math.abs(betterTemp) > Math.abs(temp)
                    || Math.abs(betterTemp) == Math.abs(temp) && temp > betterTemp) {
                betterTemp = temp;
            }
        }
        System.out.println(betterTemp);
    }