#include <bits/stdc++.h>
using namespace std;
char s[10010];
int main() {
  int hour, min, pre_hour = 0, pre_min = 0;
  int ans = 1, num = 1;
  char ch;
  int n;
  scanf("%d", &n);
  getchar();
  while (n--) {
    scanf("[%d:%d ", &hour, &min);
    ch = getchar();
    gets(s);
    hour %= 12;
    if (ch == 'p') hour += 12;
    if (hour < pre_hour || hour == pre_hour && min < pre_min) ans++;
    if (hour == pre_hour && min == pre_min)
      num++;
    else
      num = 1;
    if (num > 10) ans++, num = 1;
    pre_hour = hour, pre_min = min;
  }
  printf("%d", ans);
  return 0;
}
