#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const long long maxn = 1e6 + 5;
const int N = 1e4 + 5;
char s[N];
int main() {
  int n;
  scanf("%d", &n);
  getchar();
  int x, y, u = 100, v = 0;
  char c;
  int cnt = 0;
  int tot = 1;
  for (int i = 1; i <= n; i++) {
    scanf("[%d:%d %c", &x, &y, &c);
    gets(s);
    x %= 12;
    if (c == 'p') x += 12;
    if (x * 60 + y < u * 60 + v) cnt++;
    if (x * 60 + y == u * 60 + v)
      tot++;
    else
      tot = 1;
    if (tot > 10) cnt++, tot = 1;
    u = x, v = y;
  }
  cout << cnt << '\n';
  return 0;
}
