#include <bits/stdc++.h>
using namespace std;
const long long mod = 100000007;
char s[10100], ch;
long long n, h, m, ph, pm, ans = 1, num;
int main(void) {
  scanf("%lld", &n);
  getchar();
  while (n--) {
    scanf("[%lld:%lld ", &h, &m);
    ch = getchar();
    gets(s);
    h %= 12;
    if (ch == 'p') h += 12;
    if (h < ph || (h == ph && m < pm)) ans++;
    if (h == ph && m == pm)
      num++;
    else
      num = 1;
    if (num > 10) {
      ans++;
      num = 1;
    }
    ph = h, pm = m;
  }
  printf("%lld", ans);
  return 0;
}
