#include <bits/stdc++.h>
using namespace std;
int time_convert(int h, int m, bool pm) {
  int ntime = h;
  if (h == 12) ntime = 0;
  if (pm) ntime += 12;
  ntime *= 100;
  return ntime + m;
}
int main() {
  ifstream ifile("input.txt");
  if (ifile) freopen("input.txt", "rt", stdin);
  if (ifile) freopen("output.txt", "wt", stdout);
  int n;
  cin >> n;
  string lst_log;
  stringstream ss;
  getline(cin, lst_log);
  int lst_time = 9999;
  int min = 0;
  int h;
  int m;
  bool pm = 0;
  int cnt = 1;
  while (n--) {
    getline(cin, lst_log);
    ss << lst_log.substr(1, 2) << endl;
    ss >> h;
    ss << lst_log.substr(4, 2) << endl;
    ss >> m;
    if (lst_log[7] == 'p')
      pm = 1;
    else
      pm = 0;
    int curr_time = time_convert(h, m, pm);
    if (curr_time < lst_time) {
      min++;
      cnt = 1;
    } else if (curr_time == lst_time) {
      cnt++;
      if (cnt > 10) {
        min++;
        cnt = 1;
      }
    } else {
      cnt = 1;
    }
    lst_time = curr_time;
  }
  cout << min << endl;
  return 0;
}
