It works with all numbers I entered, still I don't pass the last requirement. Any suggestions?
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));
String nr = reader.readLine();
int n = Integer.parseInt(nr);
int maximum = n;
n = n-1;
while (n > 0) {
String numb = reader.readLine();
int a = Integer.parseInt(numb);
if (a > maximum) {
maximum = a;
n--;
} else {
n--;
}
}
//write your code here
System.out.println(maximum);
}
}