public class MSKJ2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = sc.nextInt(); List<Integer> list = new ArrayList<>(); sc.nextLine(); for (int i = 0; i < count; i++) { list.add(sc.nextInt()); } boolean flag = true; while(flag){ for (int i = 0; i < list.size()-1; i++) { if ((list.get(i) + list.get(i+1)) % 10 == 0){ list.remove(i); list.remove(i); flag = true; break; }else{ flag =false; } } if (list.size() < 2){ flag = false; } } System.out.println(count-list.size()); } }