#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
template <typename T1, typename T2>
void mapped(map<T1, T2> m) {
  for (auto ite = m.begin(); ite != m.end(); ++ite) {
    cout << "'" << ite->first << "'"
         << " : " << ite->second << endl;
  }
}
template <typename T1, typename T2>
void mappedArr(map<T1, vector<T2>> m) {
  for (auto ity = m.begin(); ity != m.end(); ++ity) {
    cout << "'" << ity->first << "'"
         << " : "
         << "[";
    for (int i = 0; i < (int)ity->second.size(); ++i) {
      (i == (int)ity->second.size() - 1) ? cout << ity->second[i]
                                         : cout << ity->second[i] << ",";
    }
    cout << "]" << endl;
  }
}
string int_to_string(int x) {
  stringstream ss;
  ss << x;
  string ni = ss.str();
  return ni;
}
int char_to_int(char c) {
  int n = (int)c - 48;
  return n;
}
int string_to_int(string x) {
  int n;
  stringstream s(x);
  s >> n;
  return n;
}
template <typename T1, typename T2>
void ArrPair(vector<pair<T1, T2>> vp) {
  for (int i = 0; i < (int)vp.size(); ++i) {
    cout << "(" << vp[i].first << "," << vp[i].second << ")" << endl;
  }
}
const int MOD = 1e9 + 7;
const long long INF = 1e18L + 5;
unordered_map<int, int> um;
unordered_set<int> us;
set<int> s;
int main() {
  int l;
  cin >> l;
  cin.ignore();
  vector<vector<int>> v(l, vector<int>(2));
  vector<string> c(l);
  for (int i = 0; i < l; ++i) {
    string s;
    getline(cin, s);
    string d1(1, s[1]);
    string d2(1, s[2]);
    string s1 = d1 + d2;
    int a1 = string_to_int(s1);
    if (a1 == 12) {
      a1 = 0;
    }
    v[i][0] = a1;
    string d4(1, s[4]);
    string d5(1, s[5]);
    string s2 = d4 + d5;
    int a2 = string_to_int(s2);
    v[i][1] = a2;
    string d6(1, s[7]);
    string d7(1, s[9]);
    c[i] = d6 + d7;
  }
  int days = 0;
  int data1 = v[0][0];
  int data2 = v[0][1];
  string data3 = c[0];
  int counting = 1;
  int i = 1;
  while (i < l) {
    if (v[i][0] == data1 && v[i][1] == data2 && c[i] == data3) {
      counting++;
    } else {
      counting = 0;
      if (days == 0) {
        days++;
      }
      if (i + 1 < l) {
        data1 = v[i + 1][0];
        data2 = v[i + 1][1];
        data3 = c[i + 1];
      }
    }
    if (counting == 10) {
      if (days == 0) {
        days += 2;
        i += 2;
      } else {
        days++;
      }
      counting = 0;
      if (i + 1 < l) {
        data1 = v[i + 1][0];
        data2 = v[i + 1][1];
        data3 = c[i + 1];
      }
    }
    if (i < l) {
      if (v[i - 1][0] < v[i][0]) {
        if (c[i - 1] == "pm" && c[i] == "am") {
          days++;
        }
      } else if (v[i - 1][0] == v[i][0]) {
        if (v[i - 1][1] < v[i][1]) {
          if (c[i - 1] == "pm" && c[i] == "am") {
            days++;
          }
        } else if (v[i - 1][1] > v[i][1]) {
          if (c[i - 1] == "am" && c[i] == "pm") {
            days = days;
          } else {
            days++;
          }
        } else {
          if (c[i - 1] == "pm" && c[i] == "am") {
            days++;
          }
        }
      } else {
        if (c[i - 1] == "am" && c[i] == "pm") {
          days = days;
        } else {
          days++;
        }
      }
    }
    ++i;
  }
  if (l > 0 && days == 0) {
    cout << 1;
    return 0;
  }
  cout << days;
}
