#include <bits/stdc++.h>
using namespace std;
char c[1001];
int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int a[101][101];
int main() {
  int n;
  int ans = 1;
  int h = 0, m = 0;
  int q = 0;
  scanf("%d\n", &n);
  for (int i = 0; i < n; i++) {
    char c;
    int ch, cm;
    scanf("[%d:%d %c.m.]: ", &ch, &cm, &c);
    string ss;
    getline(cin, ss);
    if (c == 'p') ch += 12;
    if (ch == 24 && c == 'p') ch = 12;
    if (ch == 12 && c == 'a') ch = 0;
    if (ch == h && cm == m)
      q++;
    else
      q = 1;
    if (q == 11) {
      ans++;
      q = 1;
    }
    if (h > ch) {
      ans++;
      h = ch;
      m = cm;
      continue;
    }
    if (h == ch && m > cm) {
      ans++;
      h = ch;
      m = cm;
      continue;
    }
    h = ch;
    m = cm;
  }
  cout << ans;
  return 0;
}
