#include <bits/stdc++.h>
using namespace std;
int parse(string s) {
  int res = 0;
  if (s.substr(0, 2) == "12") {
    s = "00" + s.substr(2);
  }
  if (s.substr(6) == "p.m.") {
    res += 720;
  }
  int h = 0;
  for (int i = 0; i < 2; ++i) {
    h = 10 * h + s[i] - '0';
  }
  res += h * 60;
  int m = 0;
  for (int i = 3; i < 5; ++i) {
    m = 10 * m + s[i] - '0';
  }
  res += m;
  return res;
}
int main() {
  int n = 0, last = 3000, cur = 0, res = 0, cnt = 0;
  string s;
  cin >> n;
  getline(cin, s);
  int i = 0;
  while (i < n) {
    getline(cin, s);
    s = s.substr(1, 10);
    cur = parse(s);
    if (cur < last) {
      ++res;
      cnt = 0;
    } else if (cur == last) {
      ++cnt;
      if (cnt > 9) {
        ++res;
        cnt = 0;
      }
    } else {
      cnt = 0;
    }
    last = cur;
    ++i;
  }
  cout << res << endl;
  return 0;
}
