#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p, q;
  cin >> n;
  char w, x;
  string L;
  int t[n];
  for (int i = 0; i < n; i++) {
    cin >> w >> p >> w >> q >> x;
    getline(cin, L);
    if (p != 12) {
      t[i] = 100 * (p + (x == 'p' ? 12 : 0)) + q;
    } else {
      t[i] = 100 * (p + (x == 'a' ? -12 : 0)) + q;
    }
  }
  int days = 1, same = 1;
  for (int i = 1; i < n; i++) {
    if (t[i] == t[i - 1]) {
      same++;
      if (same == 11) {
        same = 1;
        days++;
      }
    } else {
      same = 1;
      if (t[i] < t[i - 1]) days++;
    }
  }
  cout << days;
}
