#include <bits/stdc++.h>
using namespace std;
int n;
int a[1003];
char s[1003];
int main() {
  scanf("%d", &n);
  int ans = 1;
  int hour, mi;
  gets(s);
  int i;
  for (i = 0; i < n; i++) {
    gets(s);
    hour = (s[1] - '0') * 10;
    hour += (s[2] - '0');
    mi = (s[4] - '0') * 10;
    mi += (s[5] - '0');
    if (s[7] == 'p' && hour != 12) hour += 12;
    if (s[7] == 'a' && hour == 12) hour = 0;
    mi += hour * 60;
    a[i] = mi;
  }
  for (i = 1; i < n; i++)
    if (a[i] < a[i - 1]) ans++;
  i = 0;
  int j = 0;
  while (i < n) {
    j = i;
    while (j < n && a[i] == a[j]) j++;
    ans += (j - i) / 10;
    if ((j - i) % 10 == 0) ans--;
    i = j;
  }
  printf("%d\n", ans);
}
