I wrote this code, it works i think, but can't validate.
package com.codegym.task.task05.task0532;

import java.io.*;

/*
Task about algorithms

*/

public class Solution {
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int numberOfLines = Integer.parseInt(reader.readLine());
         int helper = 0;
          int maximum = 0;

        int i = 0;
        if (numberOfLines > 0) {
            while (i < numberOfLines)
        {
            helper = Integer.parseInt(reader.readLine());
            if (helper > maximum && -helper < maximum) // plus
            {
                maximum = helper;


            }
          if ((maximum > helper && (helper < 0) && (helper < -maximum))) // minus
          {
              maximum = helper;
          }
           i++;
        }
        }
        System.out.println(maximum);
    }
}
/* */