#include <bits/stdc++.h>
using namespace std;
const int mod = 7 + 1e9;
const int inf = 1e9 + 5;
const long long INF = (long long)1e18 + 5;
const int N = 100 + 5;
int a[N];
int fr[10000];
int main() {
  int n;
  string s;
  getline(cin, s);
  sscanf(s.c_str(), "%d", &n);
  for (int i = 0; i < (int)(n); i++) {
    getline(cin, s);
    int h = 0, m = 0;
    char c;
    sscanf(s.c_str(), "[%d:%d %c.m.]:", &h, &m, &c);
    a[i] = h * 60 + m;
    if (h == 12 && c == 'a') a[i] = m;
    if (c == 'p') {
      if (h != 12) a[i] += (12 * 60);
    }
  }
  int ans = 1;
  fr[a[0]] = 1;
  for (int i = 1; i < n; ++i) {
    if (a[i] == a[i - 1]) {
      fr[a[i]]++;
      if (fr[a[i]] > 10) {
        ans++;
        fr[a[i]] = 1;
      }
    } else {
      fr[a[i - 1]] = 0;
      fr[a[i]] = 1;
    }
    if (a[i] < a[i - 1] || (a[i] < 60 && a[i - 1] >= 60)) {
      ans++;
    }
  }
  cout << ans << '\n';
}
