#include <bits/stdc++.h>
using namespace std;
int n, shi, fen, ans = 1, num, t;
char a[1009], p;
int main() {
  cin >> n;
  getchar();
  for (int i = 1; i <= n; i++) {
    gets(a);
    shi = (a[1] - '0') * 10 + a[2] - '0';
    shi %= 12;
    fen = (a[4] - '0') * 10 + a[5] - '0';
    if (a[7] == 'p') shi += 12;
    fen += shi * 60;
    if (i > 1) {
      if (fen < t) ans++;
      if (fen == t) {
        num++;
        if (num > 10) {
          num = 1;
          ans++;
        }
      } else
        num = 1;
    }
    t = fen;
  }
  cout << ans;
  return 0;
}
