#include <bits/stdc++.h>
using namespace std;
const int oo = 1000000009;
const double eps = 1e-6;
const int mod = 1000000007;
const int mx = 12;
int main() {
  int t;
  cin >> t;
  string t1, t2;
  int ans = 0, cnt = 0;
  string last, dummy;
  for (int i = 0; i < (t); ++i) {
    cin >> t1 >> t2;
    getline(cin, dummy);
    if (t1[1] == '1' && t1[2] == '2') {
      t1[1] = t1[2] = '0';
    }
    string cur = t2 + t1;
    if (last == "" || cur < last) {
      cnt = 1;
      ++ans;
    } else if (last == cur) {
      if (cnt == 10) {
        ++ans;
        cnt = 1;
      } else {
        ++cnt;
      }
    } else {
      cnt = 1;
    }
    last = cur;
  }
  cout << ans << endl;
  return 0;
}
