#include <bits/stdc++.h>
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int a, b;
    char log[50];
    int x[105] = {0x3f3f3f3f}, time[105] = {0};
    getchar();
    for (int i = 1; i <= n; ++i) {
      gets(log);
      a = (log[1] - '0') * 10 + (log[2] - '0');
      b = (log[4] - '0') * 10 + (log[5] - '0');
      if (log[7] == 'a' && a == 12) {
        a = 0;
      }
      if (log[7] == 'p' && a != 12) {
        a += 12;
      }
      x[i] = a * 60 + b;
      if (x[i] == x[i - 1]) {
        time[i] = time[i - 1] + 1;
        time[i] %= 10;
      }
    }
    int answer = 0;
    for (int i = 1; i <= n; ++i) {
      if (x[i - 1] > x[i]) {
        answer += 1;
      } else if (x[i] == x[i - 1]) {
        if (time[i] == 0) {
          answer += 1;
        }
      }
    }
    printf("%d\n", answer);
  }
  return 0;
}
