День добрый! Не могу понять почему не добавляется последняя последовательность в АrrayList compare:( public class Solution { public static void main(String[] args) throws IOException { //напишите тут ваш код Scanner scan = new Scanner(System.in); List <Integer> List = new ArrayList<>(); for (int i=0; i<10;i++){ int a = scan.nextInt(); List.add(a); } Arrays.sort(new List[]{List}); ArrayList<Integer> compare = new ArrayList<>(); compare.add(1); int a=List.get(0), count =1; for (int i= 1; i<10; i++){ int b = List.get(i); if (a==b){ count++; a=b; } else if (a!=b){ a=b; compare.add(count); count =1; } } int b = compare.get(0); for (int i=1; i<compare.size();i++){ int c = compare.get(i); if (b<=c){ b=c; } } System.out.println(b); } }