please anybody! explain me what's wrong here

package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
list.add(Integer.parseInt(reader.readLine()));
}
int max = 0;
int n = 1;
for (int i = 1; i < list.size(); i++) {
if (list.get(i).equals(list.get(i - 1))) {
n++;
if (i == list.size() - 1) {
max = n;
}
}else
if (n > max) {
max = n;
n = 1;
if (n <= max) {
n = 1;
}
}
}
System.out.println(max);
}
}