#include <bits/stdc++.h>
using namespace std;
int _tointeger(int hh, int mm) { return (60 * hh + mm); }
int main() {
  string cad;
  int m;
  int res = 0;
  int ant = 10000;
  int cnt = 0;
  scanf("%d\n", &m);
  for (int i = 0; i < m; i++) {
    getline(cin, cad, '\n');
    int h = (cad[1] & 15) * 10 + (cad[2] & 15);
    int m = (cad[4] & 15) * 10 + (cad[5] & 15);
    char c = cad[7];
    if (h == 12) h = 0;
    if (c == 'p') h += 12;
    int tt = _tointeger(h, m);
    if (tt > ant)
      ant = tt, cnt = 1;
    else if (tt == ant && cnt < 10)
      cnt++;
    else {
      res++;
      ant = tt;
      cnt = 1;
    }
  }
  cout << res << endl;
  return 0;
}
