#include <bits/stdc++.h>
using namespace std;
vector<pair<string, char> > save;
int out = 1;
int n;
int judge1(int i) {
  if (i == n - 1 || save[i].second != save[i + 1].second) return 0;
  int flag = 1, flag2 = 0;
  if (save[i].first[0] == '1' && save[i].first[1] == '2') flag = 0;
  if (save[i + 1].first[0] == '1' && save[i + 1].first[1] == '2') flag2 = 1;
  if (!flag && flag2 && save[i].first > save[i + 1].first)
    return 1;
  else if (flag && !flag2 && save[i].first > save[i + 1].first)
    return 1;
  else if (!flag && !flag2)
    return 0;
  else if (flag && flag2)
    return 1;
  return 0;
}
int judge2(int i) {
  if (i == n - 1) return 0;
  if (save[i].second == 'p' && save[i + 1].second == 'a') return 1;
  return 0;
}
int judge3(int i) {
  if (i >= n - 10) return 0;
  int j = i;
  while (j - i < 10 && save[j].first == save[j + 1].first &&
         save[j].second == save[j + 1].second)
    j++;
  if (j - i == 10) return 1;
  return 0;
}
int main() {
  cin >> n;
  getchar();
  string temp;
  for (int i = 0; i < n; i++) {
    getline(cin, temp);
    string work;
    for (int j = 1; j <= 5; j++) work += temp[j];
    save.push_back(make_pair(work, temp[7]));
  }
  for (int i = 0; i < n; i++) {
    if (judge1(i) || judge2(i)) {
      out++;
    } else if (judge3(i)) {
      out++;
      i += 9;
    }
  }
  cout << out << endl;
  return 0;
}
