#include <bits/stdc++.h>
using namespace std;
int n, p, i, h, m, res, s;
char c;
char str[21];
int main() {
  scanf("%d", &n);
  gets(str);
  p = 1000000000;
  for (i = 0; i < n; i++) {
    scanf("[%d:%d %c.m.]: ", &h, &m, &c);
    gets(str);
    h = h % 12;
    if (c == 'p') h += 12;
    m += 60 * h;
    if (m == p)
      if (s == 10) {
        s = 1;
        res++;
      } else
        s++;
    else if (m < p) {
      res++;
      s = 1;
    } else
      s = 1;
    p = m;
  }
  printf("%d\n", res);
  return 0;
}
