import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { private static List amaouPattern = Arrays.asList("akai", "marui", "okii", "umai"); public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int cnt = 0; for (int i = 0; i < n; i++) { List strList = new ArrayList<>(); for (int j = 0; j < 4; j++) { strList.add(sc.next()); } Collections.sort(strList); if(strList.equals(amaouPattern)) cnt++; } System.out.println(cnt); } }