#include<bits/stdc++.h>
using namespace std;

#define pb emplace_back
#define mp make_pair
 
using ll = long long;
using pii = pair<int,int>;
 
constexpr int mod = 998244353;
constexpr int inf = 0x3f3f3f3f;
constexpr int N = 2e5 + 10;

void _main(){
  vector<string> a = vector<string>{"akai", "marui", "okii", "umai"};
  int n;
  cin >> n;
  int ans = 0;
  for(int i=0; i<n; ++i){
    vector<string> s(4);
    for(auto &ss : s) cin >> ss;
    sort(s.begin(), s.end());
    if(a == s)  ++ans;
  }
  cout << ans << '\n';
}

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  _main();
  return 0;
}