#include using namespace std; #define rep(i, n) for(int i=0; i #include //vectorの中身を空白区切りで出力 template void print1(vector v) { for (int i = 0; i < v.size(); i++) { cout << v[i]; if (i < v.size() - 1) { cout << " "; } } } //vectorの中身を改行区切りで出力 template void print2(vector v) { for (auto x : v) { cout << x << endl; } } //二次元配列を出力 template void printvv(vector> vv) { for (vector v : vv) { print1(v); cout << endl; } } //vectorを降順にソート template void rsort(vector &v) { sort(v.begin(), v.end()); reverse(v.begin(), v.end()); } //昇順priority_queueを召喚 template struct rpriority_queue { priority_queue, greater> pq; void push(T x) { pq.push(x); } void pop() { pq.pop(); } T top() { return pq.top(); } size_t size() { return pq.size(); } bool empty() { return pq.empty(); } }; int main() { int N; cin >> N; vector amaou(4); amaou[0] = "akai"; amaou[1] = "marui"; amaou[2] = "okii"; amaou[3] = "umai"; sort(amaou.begin(), amaou.end()); int ans = 0; rep(i, N) { vector in(4); rep(j, 4) { cin >> in[j]; } sort(in.begin(), in.end()); if (in == amaou) { ans++; } } cout << ans << endl; }