#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
double pi = 3.1415926535898;
string ys = "YES\n";
string no = "NO\n";
const double EPS = 1e-6;
const int inf = 1e9 + 1;
const long long M = 1e9 + 7;
const int N = 555;
int n;
string s;
int cTime, ans;
int f() {
  if (s[1] == '1' && s[2] == '2') {
    s[1] = s[2] = '0';
  }
  int g = ((s[1] - '0') * 10 + (s[2] - '0')) * 60 + (s[4] - '0') * 10 +
          (s[5] - '0');
  if (s[7] == 'p') {
    g += 12 * 60;
  }
  return g;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n;
  getline(cin, s);
  getline(cin, s);
  cTime = f();
  int frec = 0;
  for (int i = 2; i <= int(n); i++) {
    getline(cin, s);
    int t = f();
    if (t > cTime) {
      cTime = t;
      frec = 1;
    } else if (t < cTime) {
      cTime = t;
      frec = 1;
      ans++;
    } else if (t == cTime) {
      frec++;
      if (frec > 10) {
        ans++;
        frec = 1;
      }
    }
  }
  cout << 1 + ans;
}
