#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, l, m, n;
  char s[1009];
  cin >> n;
  int x, y;
  int res[n + 10];
  getchar();
  for (i = 0; i < n; i++) {
    gets(s);
    x = (s[1] - '0') * 10 + (s[2] - '0');
    y = (s[4] - '0') * 10 + (s[5] - '0');
    int tp = 0;
    if (s[7] == 'p') tp = 720;
    if (s[1] == '1' && s[2] == '2') tp = 720 - tp;
    res[i] = 60 * x + y + tp;
    if (res[i] >= 1440) res[i] -= 1440;
  }
  int ans = 1;
  l = res[0];
  int cnt = 1;
  for (i = 1; i < n; i++) {
    if (res[i] < l) {
      l = res[i];
      ans++;
      cnt = 1;
    } else if (res[i] == l && cnt != 10)
      cnt++;
    else if (res[i] == l && cnt == 10)
      cnt = 1, ans++;
    else if (res[i] > l)
      l = res[i], cnt = 1;
  }
  cout << ans << endl;
}
