#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int answer = 1, t = 0, sn = 0;
  string dummy;
  getline(cin, dummy);
  while (n--) {
    int h, m, c;
    cin.ignore();
    cin >> h;
    cin.ignore();
    cin >> m;
    cin.ignore();
    c = cin.get();
    int current = c * 60 * 12 + (h % 12) * 60 + m;
    if (current < t) {
      ++answer;
      sn = 0;
    } else if (current == t) {
      if (sn >= 9) {
        ++answer;
        sn = 0;
      } else {
        ++sn;
      }
    } else {
      sn = 0;
    }
    t = current;
    getline(cin, dummy);
  }
  cout << answer << endl;
  return 0;
}
