#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int N = 2e5 + 10;
int main() {
  int n;
  string str;
  cin >> n;
  getline(cin, str);
  int pre = INF;
  int ans = 0;
  int cnt = 0;
  while (n--) {
    getline(cin, str);
    for (auto& c : str) {
      if (!isalnum(c)) c = ' ';
    }
    stringstream sin(str);
    int h, m;
    char o;
    sin >> h >> m >> o;
    h %= 12;
    int cur = h * 60 + m;
    if (o == 'p') cur += 12 * 60;
    if (cur < pre)
      ans++, cnt = 1;
    else if (cur == pre) {
      if (++cnt > 10) ans++, cnt -= 10;
    } else
      cnt = 1;
    pre = cur;
  }
  printf("%d\n", ans);
  return 0;
}
