just need a hint why code works but doesnt pass please
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 n = Integer.parseInt(reader.readLine());
int max=0;
int i;
//write your code here
for (i=0; i<n; i++){
int a = Integer.parseInt(reader.readLine());
if (a>=max){
max=a;
}
}
if (n>0){
System.out.println(max);
}
}
}