#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*** Typedef ***/
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
typedef    long double   ld;

//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;

/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define F(a,b) for(int i = a; i < b; i++)
#define ff1(i,a,b) for(ll i = a; i < b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/

#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define sf(a)            scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define cu continue
#define br break
#define rsz resize
#define ins insert
#define ft front
#define bk back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define MN3(n1,n2,n3) min(n1,min(n2,n3))
#define MN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))
#define MX3(n1,n2,n3) max(n1,max(n2,n3))
#define MX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))
#define mxar(a,n) *max_element(a,a+n)
#define mnar(a,n) *min_element(a,a+n)
#define arr_sm(a,n) accumulate(a,a+n,0)
#define vc_sm(ve) accumulate(ve.begin(),ve.end(),0)
#define mx_vc(ve) *max_element(ve.begin(),ve.end())
#define mn_vc(ve) *min_element(ve.begin(),ve.end())
//#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
//typedef multimap <ll> mpll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;
typedef priority_queue <pair <ll, ll> > pqpll;
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ml unordered_map<ll,ll>
///typedef    unordered_multiset<int>   umsi;
typedef    unordered_set<ll>   us;

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define czero(n)                    __builtin_popcountll(n) // count the number of 1's in the bit representation of a number
#define cenzero(n)                  __builtin_ctzll(n) // count the number of zereos from the end of the bit representation of a number until a 1
#define countbegzero(n)             __builtin_clzxll(n)
#define checkparity(n)              __builtin_parityll(n)// checks whether the number of bits are even or odd
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define ip(n) ll n; cin>>n;
#define ipp(n,k) ll n; cin>>n; ll k; cin>>k;
#define ip3(n,m,k) ll n; cin>>n;ll m;cin>>m; ll k; cin>>k;
#define kl    '\n'
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define w(x)             ll x; cin>>x; while(x--)
#define go(i, a) for (auto &i : a)
#define go1(it, v) for(auto it = v.begin(); it != v.end(); ++it)
#define mk(arr,n,type) type *arr=new type[n];
#define sz(obj) (int(obj.size()))
#define ipve(vc,n) vll vc(n); ff1(i,0,n){cin>>vc[i];}
#define ipvc(vc,n) vll vc; ff1(i,0,n){ip(x);vc.pb(x);}
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define depressed()                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//bool ans = all_of(arr, arr + 6, [](int x) {return x & 1; } );
const double pi = 3.141592653589793238460;
#define TRC
#ifdef TRC
#define trc(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trc(...)
#endif
void fun()
{
    string s;
    ip(n);
    vll a;
 for(ll  i = 0;i<n;i++){
    string x,y; cin>>x>>y;
    ll k = (x[1]-'0')*10+(x[2]-'0');
    if(k == 12) k = 0;
    if(y[0] == 'p') k+=12;
    k*=60;
    k +=(x[4] - '0')*10 + (x[5] - '0');
    a.pb(k);
    getline(cin,s);
}
ll ct = 1;
ll day = 1;
//go(i,a) cout<<i<<kl;
ff1(i,1,n)
{
    if(a[i-1]>a[i])
    {
        day++;
        //trc(day);
    }
    else if(a[i] == a[i-1]){
        ct++;
        if(ct == 10){day++;i++;ct = 1;}
    }
    else ct = 0;
}
 cout<<day;
}

int main()
{
//     ofstream cout ("ride.out");
//     ifstream cin ("ride.in");
    depressed();
  ll t = 1;
  //cin>>t;
  while(t--)
  {
     fun();
  }
  //cer;
  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*** Typedef ***/
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
typedef    long double   ld;

//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;

/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define F(a,b) for(int i = a; i < b; i++)
#define ff1(i,a,b) for(ll i = a; i < b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/

#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define sf(a)            scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define cu continue
#define br break
#define rsz resize
#define ins insert
#define ft front
#define bk back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define MN3(n1,n2,n3) min(n1,min(n2,n3))
#define MN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))
#define MX3(n1,n2,n3) max(n1,max(n2,n3))
#define MX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))
#define mxar(a,n) *max_element(a,a+n)
#define mnar(a,n) *min_element(a,a+n)
#define arr_sm(a,n) accumulate(a,a+n,0)
#define vc_sm(ve) accumulate(ve.begin(),ve.end(),0)
#define mx_vc(ve) *max_element(ve.begin(),ve.end())
#define mn_vc(ve) *min_element(ve.begin(),ve.end())
//#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
//typedef multimap <ll> mpll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;
typedef priority_queue <pair <ll, ll> > pqpll;
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ml unordered_map<ll,ll>
///typedef    unordered_multiset<int>   umsi;
typedef    unordered_set<ll>   us;

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define czero(n)                    __builtin_popcountll(n) // count the number of 1's in the bit representation of a number
#define cenzero(n)                  __builtin_ctzll(n) // count the number of zereos from the end of the bit representation of a number until a 1
#define countbegzero(n)             __builtin_clzxll(n)
#define checkparity(n)              __builtin_parityll(n)// checks whether the number of bits are even or odd
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define ip(n) ll n; cin>>n;
#define ipp(n,k) ll n; cin>>n; ll k; cin>>k;
#define ip3(n,m,k) ll n; cin>>n;ll m;cin>>m; ll k; cin>>k;
#define kl    '\n'
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define w(x)             ll x; cin>>x; while(x--)
#define go(i, a) for (auto &i : a)
#define go1(it, v) for(auto it = v.begin(); it != v.end(); ++it)
#define mk(arr,n,type) type *arr=new type[n];
#define sz(obj) (int(obj.size()))
#define ipve(vc,n) vll vc(n); ff1(i,0,n){cin>>vc[i];}
#define ipvc(vc,n) vll vc; ff1(i,0,n){ip(x);vc.pb(x);}
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define depressed()                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//bool ans = all_of(arr, arr + 6, [](int x) {return x & 1; } );
const double pi = 3.141592653589793238460;
#define TRC
#ifdef TRC
#define trc(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trc(...)
#endif
void fun()
{
    string s;
    ip(n);
    vll a;
 for(ll  i = 0;i<n;i++){
    string x,y; cin>>x>>y;
    ll k = (x[1]-'0')*10+(x[2]-'0');
    if(k == 12) k = 0;
    if(y[0] == 'a') k+=12;
    k*=60;
    k +=(x[4] - '0')*10 + (x[5] - '0');
    a.pb(k);
    getline(cin,s);
}
ll ct = 1;
ll day = 1;
//go(i,a) cout<<i<<kl;
ff1(i,1,sz(a))
{
    if((a[i-1]>a[i]) || (ct == 10))
    {
        day++;
        //trc(day);
        ct = 1;
    }
    else if(a[i] == a[i-1]) ct++;
    else ct = 1;
}
 cout<<day;
}

int main()
{
//     ofstream cout ("ride.out");
//     ifstream cin ("ride.in");
    depressed();
  ll t = 1;
  //cin>>t;
  while(t--)
  {
     fun();
  }
  //cer;
  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*** Typedef ***/
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
typedef    long double   ld;

//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;

/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define F(a,b) for(int i = a; i < b; i++)
#define ff1(i,a,b) for(ll i = a; i < b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/

#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define sf(a)            scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define cu continue
#define br break
#define rsz resize
#define ins insert
#define ft front
#define bk back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define MN3(n1,n2,n3) min(n1,min(n2,n3))
#define MN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))
#define MX3(n1,n2,n3) max(n1,max(n2,n3))
#define MX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))
#define mxar(a,n) *max_element(a,a+n)
#define mnar(a,n) *min_element(a,a+n)
#define arr_sm(a,n) accumulate(a,a+n,0)
#define vc_sm(ve) accumulate(ve.begin(),ve.end(),0)
#define mx_vc(ve) *max_element(ve.begin(),ve.end())
#define mn_vc(ve) *min_element(ve.begin(),ve.end())
//#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
//typedef multimap <ll> mpll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;
typedef priority_queue <pair <ll, ll> > pqpll;
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ml unordered_map<ll,ll>
///typedef    unordered_multiset<int>   umsi;
typedef    unordered_set<ll>   us;

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define czero(n)                    __builtin_popcountll(n) // count the number of 1's in the bit representation of a number
#define cenzero(n)                  __builtin_ctzll(n) // count the number of zereos from the end of the bit representation of a number until a 1
#define countbegzero(n)             __builtin_clzxll(n)
#define checkparity(n)              __builtin_parityll(n)// checks whether the number of bits are even or odd
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define ip(n) ll n; cin>>n;
#define ipp(n,k) ll n; cin>>n; ll k; cin>>k;
#define ip3(n,m,k) ll n; cin>>n;ll m;cin>>m; ll k; cin>>k;
#define kl    '\n'
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define w(x)             ll x; cin>>x; while(x--)
#define go(i, a) for (auto &i : a)
#define go1(it, v) for(auto it = v.begin(); it != v.end(); ++it)
#define mk(arr,n,type) type *arr=new type[n];
#define sz(obj) (int(obj.size()))
#define ipve(vc,n) vll vc(n); ff1(i,0,n){cin>>vc[i];}
#define ipvc(vc,n) vll vc; ff1(i,0,n){ip(x);vc.pb(x);}
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define depressed()                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//bool ans = all_of(arr, arr + 6, [](int x) {return x & 1; } );
const double pi = 3.141592653589793238460;
#define TRC
#ifdef TRC
#define trc(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trc(...)
#endif
void fun()
{
    string s;
    ip(n);
    vll a;
 for(ll  i = 0;i<n;i++){
    string x,y; cin>>x>>y;
    ll k = (x[1]-'0')*10+(x[2]-'0');
    if(k == 12) k = 0;
    if(y[0] == 'p') k+=12;
    k*=60;
    k +=(x[4] - '0')*10 + (x[5] - '0');
    a.pb(k);
    getline(cin,s);
}
ll ct = 1;
ll day = 1;
//go(i,a) cout<<i<<kl;
ff1(i,1,sz(a))
{
    if((a[i-1]>a[i]) || (ct == 10))
    {
        day++;
        //trc(day);
        ct = 0;
    }
    else if(a[i] == a[i-1]) ct++;
    else ct = 0;
}
 cout<<day;
}

int main()
{
//     ofstream cout ("ride.out");
//     ifstream cin ("ride.in");
    depressed();
  ll t = 1;
  //cin>>t;
  while(t--)
  {
     fun();
  }
  //cer;
  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*** Typedef ***/
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
typedef    long double   ld;

//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;

/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define F(a,b) for(int i = a; i < b; i++)
#define ff1(i,a,b) for(ll i = a; i < b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/

#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define sf(a)            scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define cu continue
#define br break
#define rsz resize
#define ins insert
#define ft front
#define bk back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define MN3(n1,n2,n3) min(n1,min(n2,n3))
#define MN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))
#define MX3(n1,n2,n3) max(n1,max(n2,n3))
#define MX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))
#define mxar(a,n) *max_element(a,a+n)
#define mnar(a,n) *min_element(a,a+n)
#define arr_sm(a,n) accumulate(a,a+n,0)
#define vc_sm(ve) accumulate(ve.begin(),ve.end(),0)
#define mx_vc(ve) *max_element(ve.begin(),ve.end())
#define mn_vc(ve) *min_element(ve.begin(),ve.end())
//#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
//typedef multimap <ll> mpll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;
typedef priority_queue <pair <ll, ll> > pqpll;
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ml unordered_map<ll,ll>
///typedef    unordered_multiset<int>   umsi;
typedef    unordered_set<ll>   us;

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define czero(n)                    __builtin_popcountll(n) // count the number of 1's in the bit representation of a number
#define cenzero(n)                  __builtin_ctzll(n) // count the number of zereos from the end of the bit representation of a number until a 1
#define countbegzero(n)             __builtin_clzxll(n)
#define checkparity(n)              __builtin_parityll(n)// checks whether the number of bits are even or odd
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define ip(n) ll n; cin>>n;
#define ipp(n,k) ll n; cin>>n; ll k; cin>>k;
#define ip3(n,m,k) ll n; cin>>n;ll m;cin>>m; ll k; cin>>k;
#define kl    '\n'
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define w(x)             ll x; cin>>x; while(x--)
#define go(i, a) for (auto &i : a)
#define go1(it, v) for(auto it = v.begin(); it != v.end(); ++it)
#define mk(arr,n,type) type *arr=new type[n];
#define sz(obj) (int(obj.size()))
#define ipve(vc,n) vll vc(n); ff1(i,0,n){cin>>vc[i];}
#define ipvc(vc,n) vll vc; ff1(i,0,n){ip(x);vc.pb(x);}
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define depressed()                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//bool ans = all_of(arr, arr + 6, [](int x) {return x & 1; } );
const double pi = 3.141592653589793238460;
#define TRC
#ifdef TRC
#define trc(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trc(...)
#endif
void fun()
{
    string s;
    ip(n);
    vll a;
 for(ll  i = 0;i<n;i++){
    string x,y; cin>>x>>y;
    ll k = (x[1]-'0')*10+(x[2]-'0');
    if(y[0] == 'p') k+=12;
    k*=60;
    k +=(x[4] - '0')*10 + (x[5] - '0');
    a.pb(k);
    getline(cin,s);
}
ll ct = 0;
ll day = 1;
//go(i,a) cout<<i<<kl;
ff1(i,1,sz(a))
{
    if((a[i-1]>a[i]) || (ct == 10))
    {
        day++;
        //trc(day);
        ct = 0;
    }
    else if(a[i] == a[i-1]) ct++;
    else ct = 0;
}
 cout<<day;
}

int main()
{
//     ofstream cout ("ride.out");
//     ifstream cin ("ride.in");
    depressed();
  ll t = 1;
  //cin>>t;
  while(t--)
  {
     fun();
  }#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*** Typedef ***/
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
typedef    long double   ld;

//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;

/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define F(a,b) for(int i = a; i < b; i++)
#define ff1(i,a,b) for(ll i = a; i < b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/

#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define sf(a)            scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define cu continue
#define br break
#define rsz resize
#define ins insert
#define ft front
#define bk back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define MN3(n1,n2,n3) min(n1,min(n2,n3))
#define MN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))
#define MX3(n1,n2,n3) max(n1,max(n2,n3))
#define MX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))
#define mxar(a,n) *max_element(a,a+n)
#define mnar(a,n) *min_element(a,a+n)
#define arr_sm(a,n) accumulate(a,a+n,0)
#define vc_sm(ve) accumulate(ve.begin(),ve.end(),0)
#define mx_vc(ve) *max_element(ve.begin(),ve.end())
#define mn_vc(ve) *min_element(ve.begin(),ve.end())
//#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
//typedef multimap <ll> mpll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;
typedef priority_queue <pair <ll, ll> > pqpll;
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ml unordered_map<ll,ll>
///typedef    unordered_multiset<int>   umsi;
typedef    unordered_set<ll>   us;

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define czero(n)                    __builtin_popcountll(n) // count the number of 1's in the bit representation of a number
#define cenzero(n)                  __builtin_ctzll(n) // count the number of zereos from the end of the bit representation of a number until a 1
#define countbegzero(n)             __builtin_clzxll(n)
#define checkparity(n)              __builtin_parityll(n)// checks whether the number of bits are even or odd
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define ip(n) ll n; cin>>n;
#define ipp(n,k) ll n; cin>>n; ll k; cin>>k;
#define ip3(n,m,k) ll n; cin>>n;ll m;cin>>m; ll k; cin>>k;
#define kl    '\n'
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define w(x)             ll x; cin>>x; while(x--)
#define go(i, a) for (auto &i : a)
#define go1(it, v) for(auto it = v.begin(); it != v.end(); ++it)
#define mk(arr,n,type) type *arr=new type[n];
#define sz(obj) (int(obj.size()))
#define ipve(vc,n) vll vc(n); ff1(i,0,n){cin>>vc[i];}
#define ipvc(vc,n) vll vc; ff1(i,0,n){ip(x);vc.pb(x);}
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define depressed()                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//bool ans = all_of(arr, arr + 6, [](int x) {return x & 1; } );
const double pi = 3.141592653589793238460;
#define TRC
#ifdef TRC
#define trc(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trc(...)
#endif
void fun()
{
    string s;
    ip(n);
    vll a;
 for(ll  i = 0;i<n;i++){
    string x,y; cin>>x>>y;
    ll k = (x[1]-'0')*10+(x[2]-'0');
    if(k == 12) k = 0;
    if(y[0] == 'p') k+=12;
    k*=60;
    k +=(x[4] - '0')*10 + (x[5] - '0');
    a.pb(k);
    getline(cin,s);
}
ll ct = 0;
ll day = 1;
//go(i,a) cout<<i<<kl;
ff1(i,1,sz(a))
{
    if((a[i-1]>a[i]) || (ct == 10))
    {
        day++;
        //trc(day);
        ct = 0;
    }
    else if(a[i] == a[i-1]) ct++;
    else ct = 0;
}
 cout<<day;
}

int main()
{
//     ofstream cout ("ride.out");
//     ifstream cin ("ride.in");
    depressed();
  ll t = 1;
  //cin>>t;
  while(t--)
  {
     fun();
  }
  //cer;
  return 0;
}

  //cer;
  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*** Typedef ***/
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
typedef    long double   ld;

//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;

/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define F(a,b) for(int i = a; i < b; i++)
#define ff1(i,a,b) for(ll i = a; i < b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/

#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define sf(a)            scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define cu continue
#define br break
#define rsz resize
#define ins insert
#define ft front
#define bk back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define MN3(n1,n2,n3) min(n1,min(n2,n3))
#define MN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))
#define MX3(n1,n2,n3) max(n1,max(n2,n3))
#define MX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))
#define mxar(a,n) *max_element(a,a+n)
#define mnar(a,n) *min_element(a,a+n)
#define arr_sm(a,n) accumulate(a,a+n,0)
#define vc_sm(ve) accumulate(ve.begin(),ve.end(),0)
#define mx_vc(ve) *max_element(ve.begin(),ve.end())
#define mn_vc(ve) *min_element(ve.begin(),ve.end())
//#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
//typedef multimap <ll> mpll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;
typedef priority_queue <pair <ll, ll> > pqpll;
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ml unordered_map<ll,ll>
///typedef    unordered_multiset<int>   umsi;
typedef    unordered_set<ll>   us;

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define czero(n)                    __builtin_popcountll(n) // count the number of 1's in the bit representation of a number
#define cenzero(n)                  __builtin_ctzll(n) // count the number of zereos from the end of the bit representation of a number until a 1
#define countbegzero(n)             __builtin_clzxll(n)
#define checkparity(n)              __builtin_parityll(n)// checks whether the number of bits are even or odd
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define ip(n) ll n; cin>>n;
#define ipp(n,k) ll n; cin>>n; ll k; cin>>k;
#define ip3(n,m,k) ll n; cin>>n;ll m;cin>>m; ll k; cin>>k;
#define kl    '\n'
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define w(x)             ll x; cin>>x; while(x--)
#define go(i, a) for (auto &i : a)
#define go1(it, v) for(auto it = v.begin(); it != v.end(); ++it)
#define mk(arr,n,type) type *arr=new type[n];
#define sz(obj) (int(obj.size()))
#define ipve(vc,n) vll vc(n); ff1(i,0,n){cin>>vc[i];}
#define ipvc(vc,n) vll vc; ff1(i,0,n){ip(x);vc.pb(x);}
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define depressed()                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//bool ans = all_of(arr, arr + 6, [](int x) {return x & 1; } );
const double pi = 3.141592653589793238460;
#define TRC
#ifdef TRC
#define trc(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trc(...)
#endif
void fun()
{
    string s;
    ip(n);
    vll a;
 for(ll  i = 0;i<n;i++){
    string x,y; cin>>x>>y;
    ll k = (x[1]-'0')*10+(x[2]-'0');
    if(k == 12) k = 0;
    if(y[0] == 'p') k+=12;
    k*=60;
    k +=(x[4] - '0')*10 + (x[5] - '0');
    a.pb(k);
    getline(cin,s);
}
ll ct = 1;
ll day = 1;
//go(i,a) cout<<i<<kl;
ff1(i,1,n)
{
    if(a[i-1]>a[i])
    {
        day++;
        //trc(day);
    }
    else if(a[i] == a[i-1]){
        ct++;
        if(ct == 10){day++;ct = 1;}
    }
    else ct = 1;
}
 cout<<day;
}

int main()
{
//     ofstream cout ("ride.out");
//     ifstream cin ("ride.in");
    depressed();
  ll t = 1;
  //cin>>t;
  while(t--)
  {
     fun();
  }
  //cer;
  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*** Typedef ***/
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
typedef    long double   ld;

//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;

/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define F(a,b) for(int i = a; i < b; i++)
#define ff1(i,a,b) for(ll i = a; i < b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/

#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define sf(a)            scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define cu continue
#define br break
#define rsz resize
#define ins insert
#define ft front
#define bk back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define MN3(n1,n2,n3) min(n1,min(n2,n3))
#define MN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))
#define MX3(n1,n2,n3) max(n1,max(n2,n3))
#define MX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))
#define mxar(a,n) *max_element(a,a+n)
#define mnar(a,n) *min_element(a,a+n)
#define arr_sm(a,n) accumulate(a,a+n,0)
#define vc_sm(ve) accumulate(ve.begin(),ve.end(),0)
#define mx_vc(ve) *max_element(ve.begin(),ve.end())
#define mn_vc(ve) *min_element(ve.begin(),ve.end())
//#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
//typedef multimap <ll> mpll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;
typedef priority_queue <pair <ll, ll> > pqpll;
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ml unordered_map<ll,ll>
///typedef    unordered_multiset<int>   umsi;
typedef    unordered_set<ll>   us;

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define czero(n)                    __builtin_popcountll(n) // count the number of 1's in the bit representation of a number
#define cenzero(n)                  __builtin_ctzll(n) // count the number of zereos from the end of the bit representation of a number until a 1
#define countbegzero(n)             __builtin_clzxll(n)
#define checkparity(n)              __builtin_parityll(n)// checks whether the number of bits are even or odd
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define ip(n) ll n; cin>>n;
#define ipp(n,k) ll n; cin>>n; ll k; cin>>k;
#define ip3(n,m,k) ll n; cin>>n;ll m;cin>>m; ll k; cin>>k;
#define kl    '\n'
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define w(x)             ll x; cin>>x; while(x--)
#define go(i, a) for (auto &i : a)
#define go1(it, v) for(auto it = v.begin(); it != v.end(); ++it)
#define mk(arr,n,type) type *arr=new type[n];
#define sz(obj) (int(obj.size()))
#define ipve(vc,n) vll vc(n); ff1(i,0,n){cin>>vc[i];}
#define ipvc(vc,n) vll vc; ff1(i,0,n){ip(x);vc.pb(x);}
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define depressed()                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//bool ans = all_of(arr, arr + 6, [](int x) {return x & 1; } );
const double pi = 3.141592653589793238460;
#define TRC
#ifdef TRC
#define trc(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trc(...)
#endif
void fun()
{
    string s;
    ip(n);
    vll a;
 for(ll  i = 0;i<n;i++){
    string x,y; cin>>x>>y;
    ll k = (x[1]-'0')*10+(x[2]-'0');
    if(k == 12) k = 0;
    if(y[0] == 'p') k+=12;
    k*=60;
    k +=(x[4] - '0')*10 + (x[5] - '0');
    a.pb(k);
    getline(cin,s);
}
ll ct = 1;
ll day = 1;
//go(i,a) cout<<i<<kl;
ff1(i,1,n)
{
    if((a[i-1]>a[i]) || (a[i-1] == a[i] && ct == 10))
    {
        day++;
        //trc(day);
        ct = 1;
    }
    else if(a[i] == a[i-1]) ct++;
    else ct = 1;
}
 cout<<day;
}

int main()
{
//     ofstream cout ("ride.out");
//     ifstream cin ("ride.in");
    depressed();
  ll t = 1;
  //cin>>t;
  while(t--)
  {
     fun();
  }
  //cer;
  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*** Typedef ***/
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
typedef    long double   ld;

//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;

/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define F(a,b) for(int i = a; i < b; i++)
#define ff1(i,a,b) for(ll i = a; i < b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/

#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define sf(a)            scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define cu continue
#define br break
#define rsz resize
#define ins insert
#define ft front
#define bk back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define MN3(n1,n2,n3) min(n1,min(n2,n3))
#define MN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))
#define MX3(n1,n2,n3) max(n1,max(n2,n3))
#define MX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))
#define mxar(a,n) *max_element(a,a+n)
#define mnar(a,n) *min_element(a,a+n)
#define arr_sm(a,n) accumulate(a,a+n,0)
#define vc_sm(ve) accumulate(ve.begin(),ve.end(),0)
#define mx_vc(ve) *max_element(ve.begin(),ve.end())
#define mn_vc(ve) *min_element(ve.begin(),ve.end())
//#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
//typedef multimap <ll> mpll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;
typedef priority_queue <pair <ll, ll> > pqpll;
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ml unordered_map<ll,ll>
///typedef    unordered_multiset<int>   umsi;
typedef    unordered_set<ll>   us;

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define czero(n)                    __builtin_popcountll(n) // count the number of 1's in the bit representation of a number
#define cenzero(n)                  __builtin_ctzll(n) // count the number of zereos from the end of the bit representation of a number until a 1
#define countbegzero(n)             __builtin_clzxll(n)
#define checkparity(n)              __builtin_parityll(n)// checks whether the number of bits are even or odd
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define ip(n) ll n; cin>>n;
#define ipp(n,k) ll n; cin>>n; ll k; cin>>k;
#define ip3(n,m,k) ll n; cin>>n;ll m;cin>>m; ll k; cin>>k;
#define kl    '\n'
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define w(x)             ll x; cin>>x; while(x--)
#define go(i, a) for (auto &i : a)
#define go1(it, v) for(auto it = v.begin(); it != v.end(); ++it)
#define mk(arr,n,type) type *arr=new type[n];
#define sz(obj) (int(obj.size()))
#define ipve(vc,n) vll vc(n); ff1(i,0,n){cin>>vc[i];}
#define ipvc(vc,n) vll vc; ff1(i,0,n){ip(x);vc.pb(x);}
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define depressed()                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//bool ans = all_of(arr, arr + 6, [](int x) {return x & 1; } );
const double pi = 3.141592653589793238460;
#define TRC
#ifdef TRC
#define trc(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trc(...)
#endif
void fun()
{
    string s;
    ip(n);
    vll a;
 for(ll  i = 0;i<n;i++){
    string x,y; cin>>x>>y;
    ll k = (x[1]-'0')*10+(x[2]-'0');
    if(k == 12) k = 0;
    if(y[0] == 'p') k+=12;
    k*=60;
    k +=(x[4] - '0')*10 + (x[5] - '0');
    a.pb(k);
    getline(cin,s);
}
ll ct = 1;
ll day = 1;
//go(i,a) cout<<i<<kl;
ff1(i,1,n)
{
    if((a[i-1]>a[i]) || (ct == 10))
    {
        day++;
        //trc(day);
        ct = 1;
    }
    else if(a[i] == a[i-1]) ct++;
    else ct = 1;
}
 cout<<day;
}

int main()
{
//     ofstream cout ("ride.out");
//     ifstream cin ("ride.in");
    depressed();
  ll t = 1;
  //cin>>t;
  while(t--)
  {
     fun();
  }
  //cer;
  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*** Typedef ***/
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
typedef    long double   ld;

//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;

/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define F(a,b) for(int i = a; i < b; i++)
#define ff1(i,a,b) for(ll i = a; i < b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/

#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define sf(a)            scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define cu continue
#define br break
#define rsz resize
#define ins insert
#define ft front
#define bk back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define MN3(n1,n2,n3) min(n1,min(n2,n3))
#define MN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))
#define MX3(n1,n2,n3) max(n1,max(n2,n3))
#define MX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))
#define mxar(a,n) *max_element(a,a+n)
#define mnar(a,n) *min_element(a,a+n)
#define arr_sm(a,n) accumulate(a,a+n,0)
#define vc_sm(ve) accumulate(ve.begin(),ve.end(),0)
#define mx_vc(ve) *max_element(ve.begin(),ve.end())
#define mn_vc(ve) *min_element(ve.begin(),ve.end())
//#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
//typedef multimap <ll> mpll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;
typedef priority_queue <pair <ll, ll> > pqpll;
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ml unordered_map<ll,ll>
///typedef    unordered_multiset<int>   umsi;
typedef    unordered_set<ll>   us;

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define czero(n)                    __builtin_popcountll(n) // count the number of 1's in the bit representation of a number
#define cenzero(n)                  __builtin_ctzll(n) // count the number of zereos from the end of the bit representation of a number until a 1
#define countbegzero(n)             __builtin_clzxll(n)
#define checkparity(n)              __builtin_parityll(n)// checks whether the number of bits are even or odd
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define ip(n) ll n; cin>>n;
#define ipp(n,k) ll n; cin>>n; ll k; cin>>k;
#define ip3(n,m,k) ll n; cin>>n;ll m;cin>>m; ll k; cin>>k;
#define kl    '\n'
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define w(x)             ll x; cin>>x; while(x--)
#define go(i, a) for (auto &i : a)
#define go1(it, v) for(auto it = v.begin(); it != v.end(); ++it)
#define mk(arr,n,type) type *arr=new type[n];
#define sz(obj) (int(obj.size()))
#define ipve(vc,n) vll vc(n); ff1(i,0,n){cin>>vc[i];}
#define ipvc(vc,n) vll vc; ff1(i,0,n){ip(x);vc.pb(x);}
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define depressed()                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//bool ans = all_of(arr, arr + 6, [](int x) {return x & 1; } );
const double pi = 3.141592653589793238460;
#define TRC
#ifdef TRC
#define trc(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trc(...)
#endif
void fun()
{
    string s;
    ip(n);
    vll a;
 for(ll  i = 0;i<n;i++){
    string x,y; cin>>x>>y;
    ll k = (x[1]-'0')*10+(x[2]-'0');
    if(k == 12) k = 0;
    if(y[0] == 'p') k+=12;
    k*=60;
    k +=(x[4] - '0')*10 + (x[5] - '0');
    a.pb(k);
    getline(cin,s);
}
ll ct = 1;
ll day = 1;
//go(i,a) cout<<i<<kl;
ff1(i,1,n)
{
    if(a[i-1]>a[i])
    {
        day++;
        //trc(day);
    }
    else if(a[i] == a[i-1]){
        if(ct == 10){day++;ct = 0;}
        ct++;
    }
    else ct = 1;
}
 cout<<day;
}

int main()
{
//     ofstream cout ("ride.out");
//     ifstream cin ("ride.in");
    depressed();
  ll t = 1;
  //cin>>t;
  while(t--)
  {
     fun();
  }
  //cer;
  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*** Typedef ***/
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
typedef    long double   ld;

//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;

/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define F(a,b) for(int i = a; i < b; i++)
#define ff1(i,a,b) for(ll i = a; i < b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/

#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define sf(a)            scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define cu continue
#define br break
#define rsz resize
#define ins insert
#define ft front
#define bk back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define MN3(n1,n2,n3) min(n1,min(n2,n3))
#define MN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))
#define MX3(n1,n2,n3) max(n1,max(n2,n3))
#define MX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))
#define mxar(a,n) *max_element(a,a+n)
#define mnar(a,n) *min_element(a,a+n)
#define arr_sm(a,n) accumulate(a,a+n,0)
#define vc_sm(ve) accumulate(ve.begin(),ve.end(),0)
#define mx_vc(ve) *max_element(ve.begin(),ve.end())
#define mn_vc(ve) *min_element(ve.begin(),ve.end())
//#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
//typedef multimap <ll> mpll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;
typedef priority_queue <pair <ll, ll> > pqpll;
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ml unordered_map<ll,ll>
///typedef    unordered_multiset<int>   umsi;
typedef    unordered_set<ll>   us;

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define czero(n)                    __builtin_popcountll(n) // count the number of 1's in the bit representation of a number
#define cenzero(n)                  __builtin_ctzll(n) // count the number of zereos from the end of the bit representation of a number until a 1
#define countbegzero(n)             __builtin_clzxll(n)
#define checkparity(n)              __builtin_parityll(n)// checks whether the number of bits are even or odd
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define ip(n) ll n; cin>>n;
#define ipp(n,k) ll n; cin>>n; ll k; cin>>k;
#define ip3(n,m,k) ll n; cin>>n;ll m;cin>>m; ll k; cin>>k;
#define kl    '\n'
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define w(x)             ll x; cin>>x; while(x--)
#define go(i, a) for (auto &i : a)
#define go1(it, v) for(auto it = v.begin(); it != v.end(); ++it)
#define mk(arr,n,type) type *arr=new type[n];
#define sz(obj) (int(obj.size()))
#define ipve(vc,n) vll vc(n); ff1(i,0,n){cin>>vc[i];}
#define ipvc(vc,n) vll vc; ff1(i,0,n){ip(x);vc.pb(x);}
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define depressed()                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//bool ans = all_of(arr, arr + 6, [](int x) {return x & 1; } );
const double pi = 3.141592653589793238460;
#define TRC
#ifdef TRC
#define trc(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trc(...)
#endif
void fun()
{
    string s;
    ip(n);
    vll a;
 for(ll  i = 0;i<n;i++){
    string x,y; cin>>x>>y;
    ll k = (x[1]-'0')*10+(x[2]-'0');
    if(k == 12) k = 0;
    if(y[0] == 'p') k+=12;
    k*=60;
    k +=(x[4] - '0')*10 + (x[5] - '0');
    a.pb(k);
    getline(cin,s);
}
ll ct = 1;
ll day = 1;
//go(i,a) cout<<i<<kl;
ff1(i,1,n)
{
    if(a[i-1]>a[i])
    {
        day++;
        //trc(day);
    }
    else if(a[i] == a[i-1]){
        ct++;
        if(ct == 10){day++;ct = 0;}
    }
    else ct = 0;
}
 cout<<day;
}

int main()
{
//     ofstream cout ("ride.out");
//     ifstream cin ("ride.in");
    depressed();
  ll t = 1;
  //cin>>t;
  while(t--)
  {
     fun();
  }
  //cer;
  return 0;
}


#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)
        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(save[i].first>save[i+1].first && save[i].second==save[i+1].second && flag)
            return 1;
    if(save[i].first<save[i+1].first && save[i].second==save[i+1].second && 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]));
    }

    //if((save[0].second == 'a' && save[n-1].second == 'p') || (save[0].second == save[n-1].second && save[0].first<save[n-1].first))
    /*for(int i=0;i<n;i++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    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;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        return 1;
}

int judge2(int i){
    if(i==n-1)
        return 0;
    if(save[i].second=='p' && save[i+1].second=='a')
        return 1;
}

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;
}

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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        if(judge1(i) /*|| judge2(i)*/){
            out++;
        }
        if(judge3(i)){
            out++;
            i+=10;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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]));
    }

    //if((save[0].second == 'a' && save[n-1].second == 'p') || (save[0].second == save[n-1].second && save[0].first<save[n-1].first))
    /*for(int i=0;i<n;i++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    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;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        if(save[i].first[0]!='1' && save[i].first[1]!='2')
            return 0;
        else
            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]));
    }

    //if((save[0].second == 'a' && save[n-1].second == 'p') || (save[0].second == save[n-1].second && save[0].first<save[n-1].first))
    /*for(int i=0;i<n;i++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        if(judge3(i)){
            out++;
            i+=9;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        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(save[i].first>save[i+1].first && save[i].second==save[i+1].second && flag)
            return 1;
    if(save[i].first<save[i+1].first && save[i].second==save[i+1].second && 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]));
    }

    //if((save[0].second == 'a' && save[n-1].second == 'p') || (save[0].second == save[n-1].second && save[0].first<save[n-1].first))
    /*for(int i=0;i<n;i++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        if(judge3(i)){
            out++;
            i+=9;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        return 1;
}

int judge2(int i){
    if(i==n-1)
        return 0;
    if(save[i].second=='p' && save[i+1].second=='a')
        return 1;
}

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;
}

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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        /*if(judge1(i) || judge2(i)){
            out++;
        }
        else*/ if(judge3(i)){
            out++;
            i+=10;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        return 1;
}

int judge2(int i){
    if(i==n-1)
        return 0;
    if(save[i].second=='p' && save[i+1].second=='a')
        return 1;
}

int judge3(int i){
    if(i>=n-10)
        return 0;
    int j=i;
    while(j!=n-1 && save[j].first==save[j+1].first && save[j].second==save[j+1].second)
        j++;
    if(j-i==10)
        return 1;
}

int main()
{
    cin>>n;
    getchar();
    char temp[1000];
    for(int i=0;i<n;i++){
        gets(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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/

    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        else if(judge3(i)){
            out++;
            i+=10;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        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;
}

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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        if(judge3(i)){
            out++;
            i+=10;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    //if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        //return 1;
}

int judge2(int i){
    if(i==n-1)
        return 0;
    if(save[i].second=='p' && save[i+1].second=='a')
        return 1;
}

int judge3(int i){
    if(i>=n-10)
        return 0;
    int j=i;
    while(j!=n-1 && save[j].first==save[j+1].first && save[j].second==save[j+1].second)
        j++;
    if(j-i==10)
        return 1;
}

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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        else if(judge3(i)){
            out++;
            i+=10;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        return 1;
}

int judge2(int i){
    if(i==n-1)
        return 0;
    if(save[i].second=='p' && save[i+1].second=='a')
        return 1;
}

int judge3(int i){
    if(i>=n-10)
        return 0;
    int j=i;
    while(j!=n-1 && save[j].first==save[j+1].first && save[j].second==save[j+1].second)
        j++;
    if(j-i==10)
        return 1;
}

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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/

    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        else if(judge3(i)){
            out++;
            i+=10;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        return 1;
}

int judge2(int i){
    if(i==n-1)
        return 0;
    if(save[i].second!=save[i+1].second)
        return 1;
}

int judge3(int i){
    if(i>=n-10)
        return 0;
    int j=i;
    while(save[j].first==save[j+1].first && save[j].second==save[j+1].second)
        j++;
    if(j-i==10)
        return 1;
}

int main()
{
    cin>>n;
    getchar();
    char temp[1000];
    for(int i=0;i<n;i++){
        gets(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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/

    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        else if(judge3(i)){
            out++;
            i+=10;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    else if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        return 1;
}

int judge2(int i){
    if(i==n-1)
        return 0;
    else if(save[i].second=='p' && save[i+1].second=='a')
        return 1;
}

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;
}

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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        if(judge3(i)){
            out++;
            i+=10;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        return 1;
}

int judge2(int i){
    if(i==n-1)
        return 0;
    if(save[i].second=='p' && save[i+1].second=='a')
        return 1;
}

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;
}

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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        else if(judge3(i)){
            out++;
            i+=10;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second && save[i].first[0]!='1' && save[i].first[1]!='2')
        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]));
    }

    //if((save[0].second == 'a' && save[n-1].second == 'p') || (save[0].second == save[n-1].second && save[0].first<save[n-1].first))
    /*for(int i=0;i<n;i++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        if(judge3(i)){
            out++;
            i+=9;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        if(judge3(i)){
            out++;
            i+=10;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        return 1;
}

int judge2(int i){
    if(i==n-1)
        return 0;
    if(save[i].second=='p' && save[i+1].second=='a')
        return 1;
}

int judge3(int i){
    if(i>=n-10)
        return 0;
    int j=i;
    while(j!=n-1 && save[j].first==save[j+1].first && save[j].second==save[j+1].second)
        j++;
    if(j-i==10)
        return 1;
}

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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }
    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        else if(judge3(i)){
            out++;
            i+=10;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        if(judge3(i)){
            out++;
            i+=9;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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(save[i].first>save[i+1].first && flag)
            return 1;
    else if(save[i].first<save[i+1].first && 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]));
    }

    //if((save[0].second == 'a' && save[n-1].second == 'p') || (save[0].second == save[n-1].second && save[0].first<save[n-1].first))
    /*for(int i=0;i<n;i++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    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;
}


#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)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        return 1;
}

int judge2(int i){
    if(i==n-1)
        return 0;
    if(save[i].second=='p' && save[i+1].second=='a')
        return 1;
}

int judge3(int i){
    if(i>=n-10)
        return 0;
    int j=i;
    while(j!=n-1 && save[j].first==save[j+1].first && save[j].second==save[j+1].second)
        j++;
    if(j-i==10)
        return 1;
}

int main()
{
    cin>>n;
    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++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/

    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        else if(judge3(i)){
            out++;
            i+=10;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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)
        return 0;
    int flag=1;
    if(save[i].first[0]=='1' && save[i].first[1]=='2')
        flag=0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second && flag)
            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]));
    }

    //if((save[0].second == 'a' && save[n-1].second == 'p') || (save[0].second == save[n-1].second && save[0].first<save[n-1].first))
    /*for(int i=0;i<n;i++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        if(judge3(i)){
            out++;
            i+=9;
        }
    }
    cout<<out<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

vector< pair<string,char> > save;
int out;
int n;

int judge1(int i){
    if(i==n-1)
        return 0;
    if(save[i].first>save[i+1].first && save[i].second==save[i+1].second)
        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]));
    }

    //if((save[0].second == 'a' && save[n-1].second == 'p') || (save[0].second == save[n-1].second && save[0].first<save[n-1].first))
    if(save[0].second == 'a')
        out=1;
    else
        out=0;
    /*for(int i=0;i<n;i++){
        cout<<save[i].first<<endl;
        cout<<save[i].second<<endl;
    }*/
    for(int i=0;i<n;i++){
        if(judge1(i) || judge2(i)){
            out++;
        }
        if(judge3(i)){
            out++;
            i+=9;
        }
    }
    cout<<out<<endl;
    return 0;
}


#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;
}


#include <bits/stdc++.h>

using namespace std;
stack <pair<int,int> >a;
int main()
{
    int n,m=0,i=0;
    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=0;
        }
        if(i>10){m++;i-=10;}
        a.push({b,c});
        m++;
    }
    cout<<m<<endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
stack <pair<int,int> >a;
int main()
{
    int n,m=0;
    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);
        if(f[1]=='p')b+=12;
        if(m)
        {
            if((b<a.top().first)||(b==a.top().first&&c<a.top().second));
            else m--;
        }
        a.push({b,c});
        m++;
    }
    cout<<m<<endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
stack <pair<int,int> >a;
int main()
{
    int n,m=0;
    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--;
        }
        a.push({b,c});
        m++;
    }
    cout<<m<<endl;
    return 0;
}


#include<iostream>
#include<math.h>
#include<set>
using namespace std;
int main() {
    int n;
    set<int> s;
    cin>>n;
    int p,q;
    cin>>p;
    for(int i=1;i<=p;i++)
	{
        int x;
        cin>>x;
        s.insert(x);
    }
    cin>>q;
    for(int i=1;i<=q;i++)
	{
        int x;
        cin>>x;
        s.insert(x);
    }
    if(s.size()==n)
		cout<<"I become the guy."<<endl;
    else
		cout<<"Oh, my keyboard!"<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;
string s;
int n;
int res,cnt;
int main()
{
    scanf("%d",&n);
    getchar();
    int pre=-1;
    while(n--)
    {
        int h,m; char c;
        scanf("[%d:%d %c",&h,&m,&c); h%=12;
        getline(cin,s);
        if(c=='p') h+=12;
        if(h*60+m<pre) res++,cnt=1;
        else if(h*60+m==pre)
        {
            if(++cnt>10) res++,cnt=1;
        }
        else cnt=1;
        pre=h*60+m;
    }
    printf("%d\n",res+1);
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <iterator>
#include <cmath>

using namespace std;

int main()
{
	if (fopen("input.txt", "r")) {
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	}
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> v;
    string s;
    getline(cin, s);
    for (int i = 0; i != n; ++i) {
        getline(cin, s);
        int t = 0;
        t += ((s[1] - '0') * 10 + s[2] - '0') * 60;
        if (s[7] == 'a') {
            if (t >= 12 * 60)
                t -= 12 * 60;
        }
        else {
            if (t < 12 * 60)
                t += 12 * 60;
        }
        t += (s[4] - '0') * 10 + s[5] - '0';
        v.push_back(t);

    }
    int ans = 0;
    int prev = 1000 * 1000 * 1000;
    int cnt = 1;
    for (auto t : v) {
        if (t == prev) {
            ++cnt;
            if (cnt > 10) {
                cnt = 1;
                ++ans;
            }
        }
        else {
            cnt = 1;
            if (t < prev)
                ++ans;
        }
        prev = t;
    }
    cout << ans;
    return 0;
}


#include <cctype>

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

const int INMINUTE = 10;

int get_time(const string &msg)
{
	int from = msg.find('['), end = msg.find(']');
	string time = msg.substr(from + 1, end - from - 1);
	bool am = time.find('a') != string::npos, pm = !am;
	for(int i = 0; i < time.size(); ++i)
		if(!isdigit(time[i]))
			time[i] = ' ';
	istringstream is(time);
	int hh, mm;
	is >> hh >> mm;
	if(hh == 12 && mm == 0)
		return am ? 0 : 12 * 60;
	return hh * 60 + mm + (pm ? 12 * 60 : 0);
}

int main(void)
{
	ios_base::sync_with_stdio(0);
	string msg;
	int n;

	bool first = true;
	int res = 0, prev = 0, here = 0;

	cin >> n;
	getline(cin, msg);
	while(n-- > 0) {
		getline(cin, msg);
		int curtime = get_time(msg);
		if(first || curtime < prev || (curtime == prev && here == INMINUTE)) {
			++res;
			first = false;
			here = 0;
		} else if(curtime == prev)
			++here;
		prev = curtime;
	}
	cout << res << endl;
	return 0;
}


#include <cctype>

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

const int INMINUTE = 10;

int get_time(const string &msg)
{
	int from = msg.find('['), end = msg.find(']');
	string time = msg.substr(from + 1, end - from - 1);
	bool am = time.find('a') != string::npos, pm = !am;
	for(int i = 0; i < time.size(); ++i)
		if(!isdigit(time[i]))
			time[i] = ' ';
	istringstream is(time);
	int hh, mm;
	is >> hh >> mm;
	if(hh == 12)
		return mm + (am ? 0 : 12 * 60);
	return hh * 60 + mm + (pm ? 12 * 60 : 0);
}

int main(void)
{
	ios_base::sync_with_stdio(0);
	string msg;
	int n;

	bool first = true;
	int res = 0, prev = 0, here = 0;

	cin >> n;
	getline(cin, msg);
	while(n-- > 0) {
		getline(cin, msg);
		int curtime = get_time(msg);
		if(first || curtime < prev || (curtime == prev && here == INMINUTE)) {
			++res;
			first = false;
			here = 1;
		} else if(curtime == prev)
			++here;
		else if(curtime > prev)
			here = 1;
		prev = curtime;
	}
	cout << res << endl;
	return 0;
}


#include <cctype>

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

const int INMINUTE = 10;

int get_time(const string &msg)
{
	int from = msg.find('['), end = msg.find(']');
	string time = msg.substr(from + 1, end - from - 1);
	int add = time.find('a') == string::npos ? 12 * 60 : 0;
	for(int i = 0; i < time.size(); ++i)
		if(!isdigit(time[i]))
			time[i] = ' ';
	istringstream is(time);
	int hh, mm;
	is >> hh >> mm;
	return hh * 60 + mm + add;
}

int main(void)
{
	ios_base::sync_with_stdio(0);
	string msg;
	int n;

	bool first = true;
	int res = 0, prev = 0, here = 0;

	cin >> n;
	getline(cin, msg);
	while(n-- > 0) {
		getline(cin, msg);
		int curtime = get_time(msg);
		if(first || curtime < prev || (curtime == prev && here == INMINUTE)) {
			++res;
			first = false;
			here = 0;
		} else if(curtime == prev)
			++here;
		prev = curtime;
	}
	cout << res << endl;
	return 0;
}


#include <cctype>

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

const int INMINUTE = 10;

int get_time(const string &msg)
{
	int from = msg.find('['), end = msg.find(']');
	string time = msg.substr(from + 1, end - from - 1);
	bool am = time.find('a') != string::npos, pm = !am;
	for(int i = 0; i < time.size(); ++i)
		if(!isdigit(time[i]))
			time[i] = ' ';
	istringstream is(time);
	int hh, mm;
	is >> hh >> mm;
	if(hh == 12)
		return mm + (am ? 0 : 12 * 60);
	return hh * 60 + mm + (pm ? 12 * 60 : 0);
}

int main(void)
{
	ios_base::sync_with_stdio(0);
	string msg;
	int n;

	bool first = true;
	int res = 0, prev = 0, here = 0;

	cin >> n;
	getline(cin, msg);
	while(n-- > 0) {
		getline(cin, msg);
		int curtime = get_time(msg);
		if(first || curtime < prev || (curtime == prev && here == INMINUTE) || curtime == 0) {
			++res;
			first = false;
			here = 1;
		} else if(curtime == prev)
			++here;
		prev = curtime;
	}
	cout << res << endl;
	return 0;
}


#include <cctype>

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

const int INMINUTE = 10;

int get_time(const string &msg)
{
	int from = msg.find('['), end = msg.find(']');
	string time = msg.substr(from + 1, end - from - 1);
	bool am = time.find('a') != string::npos, pm = !am;
	for(int i = 0; i < time.size(); ++i)
		if(!isdigit(time[i]))
			time[i] = ' ';
	istringstream is(time);
	int hh, mm;
	is >> hh >> mm;
	if(hh == 12 && mm == 0)
		return am ? 0 : 12 * 60;
	return hh * 60 + mm + (pm ? 12 * 60 : 0);
}

int main(void)
{
	ios_base::sync_with_stdio(0);
	string msg;
	int n;

	bool first = true;
	int res = 0, prev = 0, here = 0;

	cin >> n;
	getline(cin, msg);
	while(n-- > 0) {
		getline(cin, msg);
		int curtime = get_time(msg);
		if(first || curtime < prev || (curtime == prev && here == INMINUTE)) {
			++res;
			first = false;
			here = 1;
		} else if(curtime == prev)
			++here;
		prev = curtime;
	}
	cout << res << endl;
	return 0;
}


#include <cctype>

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

const int INMINUTE = 10;

int get_time(const string &msg)
{
	int from = msg.find('['), end = msg.find(']');
	string time = msg.substr(from + 1, end - from - 1);
	bool am = time.find('a') != string::npos, pm = !am;
	for(int i = 0; i < time.size(); ++i)
		if(!isdigit(time[i]))
			time[i] = ' ';
	istringstream is(time);
	int hh, mm;
	is >> hh >> mm;
	if(hh == 12)
		return am ? 0 : 12 * 60;
	return hh * 60 + mm + (pm ? 12 * 60 : 0);
}

int main(void)
{
	ios_base::sync_with_stdio(0);
	string msg;
	int n;

	bool first = true;
	int res = 0, prev = 0, here = 0;

	cin >> n;
	getline(cin, msg);
	while(n-- > 0) {
		getline(cin, msg);
		int curtime = get_time(msg);
		if(first || curtime < prev || (curtime == prev && here == INMINUTE)) {
			++res;
			first = false;
			here = 0;
		} else if(curtime == prev)
			++here;
		prev = curtime;
	}
	cout << res << endl;
	return 0;
}


#include <cctype>

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

const int INMINUTE = 10;

int get_time(const string &msg)
{
	int from = msg.find('['), end = msg.find(']');
	string time = msg.substr(from + 1, end - from - 1);
	bool am = time.find('a') != string::npos, pm = !am;
	for(int i = 0; i < time.size(); ++i)
		if(!isdigit(time[i]))
			time[i] = ' ';
	istringstream is(time);
	int hh, mm;
	is >> hh >> mm;
	if(hh == 12)
		return mm + (am ? 0 : 12 * 60);
	return hh * 60 + mm + (pm ? 12 * 60 : 0);
}

int main(void)
{
	ios_base::sync_with_stdio(0);
	string msg;
	int n;

	bool first = true;
	int res = 0, prev = 0, here = 0;

	cin >> n;
	getline(cin, msg);
	while(n-- > 0) {
		getline(cin, msg);
		int curtime = get_time(msg);
		if(first || curtime < prev || (curtime == prev && here == INMINUTE)) {
			++res;
			first = false;
			here = 1;
		} else if(curtime == prev)
			++here;
		prev = curtime;
	}
	cout << res << endl;
	return 0;
}


#pragma warning(disable: 4786 )
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<queue>
#include<algorithm>
#include<map>
#include<utility>
#include<string>
#include<iostream>
#include<vector>
#include<set>

using namespace std;

char in[100000];

int main()
{

    char st[100];
    int n,now,then,a,b;

    //freopen("in.txt","r",stdin);
    while(scanf("%d",&n)==1)
    {
        gets(in);
        int ans=1;
        now=0;
        while(n--)
        {
            int eq=0;
            gets(in);
            sscanf(in,"%*c%d%*c%d%s",&a,&b,st);
            if(a==12)
                a=0;
            then=a*100+b;
            if(st[0]=='p')
            {
                then+=1200;
            }

            if(then==now)
            {
                eq++;
                if(eq==10)
                {
                    ans++;
                    eq=0;
                }
            }
            else if(then<now)
            {
                ans++;
                eq=0;
            }
            else
                eq=0;
            now=then;
        }

        printf("%d\n",ans);
    }

    return 0;
}


#pragma warning(disable: 4786 )
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<queue>
#include<algorithm>
#include<map>
#include<utility>
#include<string>
#include<iostream>
#include<vector>
#include<set>

using namespace std;

int get_data()
{
    int minu = 0;
    int hour = 0;
    char merid = 0,c;
    char str[25] = {'\0'};
    cin >> c >> hour >> c >> minu >> merid;
    string s;
    getline(cin,s);
    if(hour == 12) hour = 0;
    if(merid == 'p')
    {
         hour+=12;
    }
    minu += hour*60;
    return minu;
}

int main()
{

    char st[100];
    int n,now,then,a,b;

    //freopen("in.txt","r",stdin);
    while(scanf("%d",&n)==1)
    {

        int ans=1;
        now=get_data();
        n--;
        while(n--)
        {
            int eq=0;
            then=get_data();

            if(then==now)
            {
                eq++;
                if(eq==10)
                {
                    ans++;
                    eq=0;
                }
            }
            else if(then<now)
            {
                ans++;
                eq=0;
            }
            else
                eq=0;
            now=then;
        }

        printf("%d\n",ans);
    }

    return 0;
}