#include <bits/stdc++.h>
using namespace std;
void solve(), solve1();
int main(int argc, const char* argv[]) {
  srand((unsigned int)time(0));
  solve();
  return 0;
}
long long mod = 1e9;
long long inf = 2 * 1e18;
long long n, m;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void solve() {
  ios::sync_with_stdio(0);
  cin >> n;
  vector<long long> a(n);
  string s;
  getline(cin, s);
  for (long long i = 0; i < n; i++) {
    long long h, min;
    char c;
    scanf("[%lld:%lld ", &h, &min);
    cin >> c;
    string s;
    getline(cin, s);
    if (h == 12) h = 0;
    long long t = h * 60 + min + (c == 'p') * 12 * 60;
    a[i] = t;
  }
  long long ans = 1;
  long long sut = 1;
  for (long long i = 1; i < n; i++) {
    if (a[i] == a[i - 1])
      sut++;
    else
      sut = 1;
    if (sut > 10 || a[i] < a[i - 1]) {
      sut = 1;
      ans++;
      for (long long j = i; j < n; j++) a[j] += 24 * 60;
    }
  }
  cout << ans;
}
