Подскажите пожалуйста. Вроде все верно выполняется. И с отрицательными числами тоже. А все равно не проходит предпоследние условие. Почему?
package com.javarush.task.task05.task0532;
import java.io.*;
/*
Задача по алгоритмам
*/
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());
if (n>0){
int[] a = new int[n];
int maximum = a[0];
for (int i=0; i<n; i++){
a[i] = Integer.parseInt(reader.readLine());
if (a[i]>=maximum){
maximum = a[i];
}
}
System.out.println(maximum);
}else{}
}
}