#include <bits/stdc++.h>
using namespace std;
int n;
int hh[111], mm[111];
char cc[111];
string s[111];
map<int, int> mp;
long long now = 0, ans = 0, last = 0;
int main() {
  cin >> n;
  for (int i = 0; i <= n; i++) {
    getline(cin, s[i]);
  }
  for (int i = 0; i <= n; i++) {
    hh[i] = (int)(s[i][1] - '0') * 10 + (int)(s[i][2] - '0');
    mm[i] = (int)(s[i][4] - '0') * 10 + (int)(s[i][5] - '0');
    cc[i] = s[i][7];
  }
  last = hh[0] * 60 + mm[0] + (cc[0] == 'p' ? 720 : 0);
  for (int i = 1; i <= n; i++) {
    now = hh[i] * 60 + mm[i] + (cc[i] == 'p' ? 720 : 0);
    if (hh[i] == 12) now -= 720;
    mp[now]++;
    if (mp[now] > 10) {
      ans++;
      mp[now] = 1;
    }
    if (now != last) mp[last] = 0;
    if (now < last) ans++;
    last = now;
  }
  cout << ans + 1;
  return 0;
}
