#include <bits/stdc++.h>
using namespace std;
void solutionD();
int main() {
  ios_base::sync_with_stdio(false);
  solutionD();
  return EXIT_SUCCESS;
}
long long n;
struct record {
  long long hh, mm;
  record(long long hh = 0, long long mm = 0) : hh(hh), mm(mm) {}
} a[128];
bool operator<(record a, record b) {
  if (a.hh == b.hh) return a.mm < b.mm;
  return a.hh < b.hh;
}
bool operator==(record a, record b) { return a.hh == b.hh && a.mm == b.mm; }
void solve() {
  long long ans = 1, len = 1;
  for (long long i = 1; i < n; ++i) {
    if (a[i] < a[i - 1]) {
      ++ans;
      len = 1;
    } else if (a[i] == a[i - 1]) {
      ++len;
    } else {
      len = 1;
    }
    if (len > 10) {
      len = 1;
      ++ans;
    }
  }
  cout << ans << endl;
}
void solutionD() {
  for (; cin >> n;) {
    string s;
    getline(cin, s);
    for (long long i = 0; i < n; ++i) {
      getline(cin, s);
      stringstream ss(s);
      char del;
      string mod;
      long long hh, mm;
      ss >> del >> hh >> del >> mm >> mod;
      if (mod.substr(0, 4) == "a.m.") {
        if (hh == 12) hh = 0;
      } else {
        if (hh != 12) hh += 12;
      }
      a[i].hh = hh;
      a[i].mm = mm;
    }
    solve();
    cerr << endl;
  }
}
