#include <bits/stdc++.h>
using namespace std;
inline int to24(string a) {
  int res = (a[7] == 'a') ? 0 : 60 * 12;
  if (a[1] != '1' || a[2] != '2') {
    res += 60 * (10 * (a[1] - 48) + a[2] - 48);
  }
  res += (10 * (a[4] - 48) + a[5] - 48);
  return res;
}
bool sm(string a, string b) { return to24(a) < to24(b); }
int main(int agrc, char *argv[]) {
  string s, t;
  int N;
  getline(cin, s);
  stringstream(s) >> N;
  int datecount = 1;
  int ec = 1;
  getline(cin, t);
  for (int tc = 1; tc < N; tc++) {
    getline(cin, s);
    if (sm(s, t)) {
      datecount++;
      ec = 1;
    }
    if (!sm(s, t) && !sm(t, s)) {
      ec++;
      if (ec > 10) {
        ec = 1;
        datecount++;
      }
    } else {
      ec = 1;
    }
    t = s;
  }
  cout << datecount << endl;
  return 0;
}
