#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, pday = 3000, res = 0, cnt = 0;
  scanf("%d", &n);
  getchar();
  for (int i = 0; i < n; i++) {
    int h, m;
    char s;
    scanf("[%d:%d %c", &h, &m, &s);
    while (getchar() != '\n')
      ;
    h %= 12;
    m += (s == 'a' ? h : h + 12) * 60;
    if (m < pday) {
      res++;
      cnt = 0;
    } else if (m == pday) {
      cnt++;
      if (cnt > 9) {
        res++;
        cnt = 0;
      }
    } else
      cnt = 0;
    pday = m;
  }
  printf("%d", res);
  return 0;
}
