#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, -1, 0, 1};
unsigned long long GCD(unsigned long long x, unsigned long long y) {
  if (y == 0)
    return x;
  else
    return GCD(y, x % y);
}
unsigned long long LCM(unsigned long long a, unsigned long long b) {
  return (a * b / (GCD(a, b)));
}
bool PRIME(int p) {
  if (p <= 1) return false;
  if (p <= 3) return true;
  if (p % 2 == 0 || p % 3 == 0) return false;
  for (int i = 5; p >= i * i; i = i + 6) {
    if (p % i == 0 || p % (i + 2) == 0) return false;
  }
  return true;
}
long long NXT(long long a) {
  if (a <= 1) return 2;
  long long p = a;
  bool x = false;
  while (!x) {
    p++;
    if (PRIME(p)) x = true;
  }
  return p;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long a, b, c, d, e, t, i, j, k, l, p, q, r, sum = 0, ans = 0, x, y, z, m,
                                                   n, u, mx = -1, mn = 1e9;
  t = 1;
  while (t--) {
    cin >> a;
    cin.ignore();
    long long cnt = 0, lti = 2000;
    while (a--) {
      string A;
      getline(cin, A);
      long long ho, mi, ti;
      ho = (A[1] - '0') * 10 + (A[2] - '0');
      mi = (A[4] - '0') * 10 + (A[5] - '0');
      ti = ho % 12;
      if (A[7] == 'p') ti += 12;
      ti *= 60;
      ti += mi;
      if (ti < lti) {
        ans++;
        cnt = 1;
      } else if (ti == lti) {
        cnt++;
        if (cnt > 10) {
          ans++;
          cnt = 1;
        }
      } else {
        cnt = 1;
      }
      lti = ti;
    }
    cout << ans << endl;
  }
  return 0;
}
