#include <bits/stdc++.h>
using namespace std;
stack<pair<int, int> > a;
int main() {
  int n, m = 0, i = 1;
  cin >> n;
  while (n--) {
    int b, c;
    char d, e, f[40];
    scanf("  ");
    scanf("%c", &d);
    scanf("%d%c%d", &b, &e, &c);
    gets(f);
    b %= 12;
    if (f[1] == 'p') b += 12;
    if (m) {
      if ((b < a.top().first) || (b == a.top().first && c < a.top().second))
        ;
      else
        m--;
      if (b == a.top().first && c == a.top().second)
        i++;
      else
        i = 1;
    }
    if (i > 10) {
      m++;
      i -= 10;
    }
    a.push({b, c});
    m++;
  }
  cout << m << endl;
  return 0;
}
