public class Solution { public static void main(String[] args) throws IOException { //напишите тут ваш код List<Integer> list = new ArrayList<>(); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); for (int i=0; i<10; i++) { list.add(Integer.parseInt(reader.readLine())); } reader.close(); int count = 1; int finalCount = 1; for (int i=list.size()-1; i>0; i--) { if (list.get(i).equals(list.get(i-1))) { count++; } else { if (finalCount < count) finalCount = count; count = 1; } } System.out.println(finalCount); } }