use std::collections::HashSet; use lib::io::Scanner; fn main() { let mut sc = Scanner::new(std::io::stdin().lock()); let n: usize = sc.next(); let s: Vec> = (0..n) .map(|_| { (0..4) .map(|_| sc.next::()) .collect::>() }) .collect(); let ans = solve(s); bufwriteln!("{ans}"); } fn solve(s: Vec>) -> usize { let amaou: HashSet = HashSet::from([ "akai".to_string(), "marui".to_string(), "okii".to_string(), "umai".to_string(), ]); s.iter().filter(|&x| x == &amaou).count() } // https://github.com/ktmtr005/competitive-rust-library #[allow(dead_code)] pub mod lib { pub mod io { pub struct Scanner { reader: R, buf: Vec, pos: usize, } impl Scanner { pub fn new(reader: R) -> Self { Scanner { reader, buf: Vec::new(), pos: 0, } } pub fn with_capacity(reader: R, capacity: usize) -> Self { Scanner { reader, buf: Vec::with_capacity(capacity), pos: 0, } } #[allow(clippy::should_implement_trait)] pub fn next(&mut self) -> T where T::Err: std::fmt::Debug, { if self.buf.is_empty() { self.read_next_line(); } let mut start = None; loop { if self.pos == self.buf.len() { break; } match (self.buf[self.pos], start.is_some()) { (b' ', true) | (b'\n', true) => break, (_, true) | (b' ', false) => self.pos += 1, (b'\n', false) => self.read_next_line(), (_, false) => start = Some(self.pos), } } let elem = unsafe { std::str::from_utf8_unchecked(&self.buf[start.unwrap()..self.pos]) }; elem.parse() .unwrap_or_else(|_| panic!("{}", format!("failed parsing: {}", elem))) } fn read_next_line(&mut self) { self.pos = 0; self.buf.clear(); if self.reader.read_until(b'\n', &mut self.buf).unwrap() == 0 { panic!("Reached EOF"); } } } #[macro_export] macro_rules! bufwrite { ($($arg:tt)*) => {{ use ::std::io::{BufWriter, Write}; let mut out = BufWriter::new(::std::io::stdout().lock()); ::std::write!(out, $($arg)*).unwrap(); }}; } #[macro_export] macro_rules! bufwriteln { ($($arg:tt)*) => {{ use ::std::io::{BufWriter, Write}; let mut out = BufWriter::new(::std::io::stdout().lock()); ::std::writeln!(out, $($arg)*).unwrap(); }}; } pub struct StdinReader { reader: R, buf: Vec, } impl StdinReader { pub fn new(reader: R) -> Self { Self { reader, buf: Vec::new(), } } pub fn read_space(&mut self) -> T { self.read_until(b' ') } pub fn read_line(&mut self) -> T { self.read_until(b'\n') } fn read_until(&mut self, delim: u8) -> T { // self.bufに次のトークンをセットする loop { self.buf.clear(); let len = self .reader .read_until(delim, &mut self.buf) .expect("failed to reading bytes"); match len { 0 => panic!("early eof"), 1 if self.buf[0] == delim => (), //区切り文字だけなのでもう一度ループ _ => { // 最後の文字が区切り文字なら削除 if self.buf[len - 1] == delim { self.buf.truncate(len - 1); } break; } } } let elem = unsafe { std::str::from_utf8_unchecked(&self.buf) }; elem.parse() .unwrap_or_else(|_| panic!("{}", format!("failed parsing: {}", elem))) } } } pub mod math { pub fn sieve_of_eratosthenes(end: usize) -> Vec { let mut is_prime = vec![true; end + 1]; (is_prime[0], is_prime[1]) = (false, false); for i in 2..=((end as f64).sqrt() as usize) { if is_prime[i] { for j in (i * 2..=end).step_by(i) { is_prime[j] = false; } } } is_prime } use super::num_trait::Zero; pub fn gcd(a: T, b: T) -> T where T: std::marker::Copy, T: std::cmp::Eq, T: std::ops::Rem, T: Zero, { if b == T::zero() { a } else { gcd::(b, a % b) } } pub fn lcm(a: T, b: T) -> T where T: std::marker::Copy, T: std::ops::Mul, T: std::ops::Div, T: std::ops::Rem, T: std::cmp::Eq, T: Zero, { a / gcd::(a, b) * b } } pub mod num_trait { pub trait Zero { fn zero() -> Self; } impl Zero for u8 { fn zero() -> Self { 0 } } impl Zero for u16 { fn zero() -> Self { 0 } } impl Zero for u32 { fn zero() -> Self { 0 } } impl Zero for u64 { fn zero() -> Self { 0 } } impl Zero for usize { fn zero() -> Self { 0 } } } }