#include <bits/stdc++.h>
const int MAXL = 1024 + 1;
int n, T;
char useless[MAXL];
inline int getTime() {
  int h, m;
  char ch;
  scanf("[%d:%d %c", &h, &m, &ch);
  if (ch == 'a' && h == 12) {
    h = 0;
  }
  if (ch == 'p' && h != 12) {
    h += 12;
  }
  gets(useless);
  return h * 60 + m;
}
int main() {
  scanf("%d\n", &n);
  T = getTime();
  int res = 1, cnt = 1;
  for (int i = 1; i < n; i++) {
    int tmpT = getTime();
    if (tmpT != T) {
      cnt = 1;
    } else {
      cnt++;
    }
    if (cnt > 10) {
      cnt -= 10;
      res++;
    } else {
      res += (tmpT < T);
    }
    T = tmpT;
  }
  printf("%d\n", res);
  return 0;
}
