#include<iostream>
using namespace std;
int main()
{ ios_base::sync_with_stdio(0);
 int n,k;  cin>>n>>k;
 for(int i=1;i<=n;i++)cout<<i<<' ';
 return 0;
}


#include<iostream>
using namespace std;
int main()
{ ios_base::sync_with_stdio(0);
 int n,k,s=1;  cin>>n>>k;
 if(k==0)k++;
 for(int i=0;i<n;i++)
 { s+=k;
   if(s>n)s-=n;
   cout<<s<<' ';
 }
 return 0;
}


#include<iostream>
using namespace std;
int main()
{ ios_base::sync_with_stdio(0);
 int n,k;  cin>>n>>k;
 for(int i=1;i<=n-k;i++)cout<<i<<' ';
 for(int i=n;i>n-k;i--) cout<<i<<' ';
 return 0;
}


#include<iostream>
using namespace std;
int main()
{ ios_base::sync_with_stdio(0);
 int n,k,s=1;  cin>>n>>k;
 for(int i=0;i<n;i++)
 { s+=k;
   if(s>n)s-=n;
   cout<<s<<' ';
 }
 return 0;
}


#include<iostream>
using namespace std;
int main()
{ ios_base::sync_with_stdio(0);
 int n,k,s=1;  cin>>n>>k;
 if(k==0)k++;
 cout<<1<<' ';
 for(int i=0;i<n-1;i++)
 { s+=k;
   if(s>n)s-=n;
   cout<<s<<' ';
 }
 return 0;
}


#include<iostream>
using namespace std;
int main()
{ ios_base::sync_with_stdio(0);
 int n,k;  cin>>n>>k;
 for(int i=n;i>n-k;i--) cout<<i<<' ';
 for(int i=1;i<=n-k;i++)cout<<i<<' ';
 return 0;
}


#include <cstdio>

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);

    for(int i = n; i >= n - (k + 1); i--)
        printf("%d ", i);

    for(int i = n - k ; i + k + 1 <= n; i++)
        printf("%d ", i);

    return 0;
}


#include <cstdio>

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);

    for(int i = 1; i <= k ; i++)
        printf("%d ", n - (i - 1));

    for(int i = 1; i + k <= n; i++)
        printf("%d ", i);

    return 0;
}


#include <cstdio>

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);

    for(int i = 0; i <= k; i++)
        printf("%d ", n - i);

    for(int i = 1; i + k < n; i++)
        printf("%d ", i);

    return 0;
}


#include <cstdio>

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);

    for(int i = n; i >= n - (k + 1); i--)
        printf("%d ", i);

    for(int i = k ; i + k + 1 <= n; i++)
        printf("%d ", i);

    return 0;
}


//Turonchik Artur
//include <brain.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <utility>
#include <algorithm>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <time.h>
#include <numeric>

using namespace std;
const int nmax = 1e6+11;
const int maxn = 1108;
const int inf = 1e9+7;

#define fof(i,a,b) for(int i = a; i <= b; i++)
#define rev(i,a,b)	for(int i = a; i >= b; i--)
#define in(x) scanf("%d",&x);
#define out(x) printf("%d ",x);
#define endl puts("");

int k,a[nmax],n;

main()
{
in(n);
in(k);
fof(i,1,n)
	a[i]=i;
if(n-1==k) {
	rev(i,n,1)
		out(a[i]);
	}
else if(k==0){
	fof(i,1,n)
		out(a[i]);
	}
else
	{
	int l=1,r=0;
	cout<<1<<" ";
	fof(i,1,k)
		{
		out(a[n-r]);
		out(a[1+l]);
		l++;
		r++;
		}
	fof(i,l,n-r-1)
		out(a[i]);
	}
}


//Turonchik Artur
//include <brain.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <utility>
#include <algorithm>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <time.h>
#include <numeric>

using namespace std;
const int nmax = 1e6+11;
const int maxn = 1108;
const int inf = 1e9+7;

#define fof(i,a,b) for(int i = a; i <= b; i++)
#define rev(i,a,b)	for(int i = a; i >= b; i--)
#define in(x) scanf("%d",&x);
#define out(x) printf("%d ",x);
#define endl puts("");

int k,a[nmax],n;

main()
{
in(n);
in(k);
fof(i,1,n)
	a[i]=i;
if(n-1==k) {
	rev(i,n,1)
		out(a[i]);
	}
else if(k==0){
	fof(i,1,n)
		out(a[i]);
	}
else
	{
	int l=1,r=0;
	cout<<1<<" ";
	fof(i,1,k-1)
		{
		out(a[n-r]);
		if(a[l+1]==a[n-(r+2)])
			{
			out(a[n-(r+1)]);
			out(a[l+1]);
			l+=2;r+=2;
			break;
			}
		out(a[1+l]);
		l++;
		r++;
		}
	fof(i,l+1,n-r)
		out(a[i]);
	}
}


//Turonchik Artur
//include <brain.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <utility>
#include <algorithm>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <time.h>
#include <numeric>

using namespace std;
const int nmax = 1e6+11;
const int maxn = 1108;
const int inf = 1e9+7;

#define fof(i,a,b) for(int i = a; i <= b; i++)
#define rev(i,a,b)	for(int i = a; i >= b; i--)
#define in(x) scanf("%d",&x);
#define out(x) printf("%d ",x);
#define endl puts("");

int k,a[nmax],n;

main()
{
in(n);
in(k);
fof(i,1,n)
	a[i]=i;
if(n-1==k) {
	rev(i,n,1)
		out(a[i]);
	}
else if(k==0){
	fof(i,1,n)
		out(a[i]);
	}
else
	{
	int l=1,r=0;
	cout<<1<<" ";
	fof(i,1,k)
		{
		out(a[n-r]);
		out(a[1+l]);
		l++;
		r++;
		}
	fof(i,l+1,n-r)
		out(a[i]);
	}
}


//Turonchik Artur
//include <brain.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <utility>
#include <algorithm>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <time.h>
#include <numeric>

using namespace std;
const int nmax = 1e6+11;
const int maxn = 1108;
const int inf = 1e9+7;

#define fof(i,a,b) for(int i = a; i <= b; i++)
#define rev(i,a,b)	for(int i = a; i >= b; i--)
#define in(x) scanf("%d",&x);
#define out(x) printf("%d ",x);
#define endl puts("");

int k,a[nmax],n;

main()
{
in(n);
in(k);
fof(i,1,n)
	a[i]=i;
if(n-1==k) {
	rev(i,n,1)
		out(a[i]);
	}
else if(k==0){
	fof(i,1,n)
		out(a[i]);
	}
else
	{
	int l=1,r=0;
	cout<<1<<" ";
	fof(i,1,k)
		{
		out(a[n-r]);
		if(a[l+1]==a[n-(r+2)] && i==k-1)
			{
			out(a[n-(r+1)]);
			out(a[l+1]);
			l+=2;r+=2;
			break;
			}
		out(a[1+l]);
		l++;
		r++;
		}
	fof(i,l+1,n-r)
		out(a[i]);
	}
}


//Turonchik Artur
//include <brain.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <utility>
#include <algorithm>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <time.h>
#include <numeric>

using namespace std;
const int nmax = 1e6+11;
const int maxn = 1108;
const int inf = 1e9+7;

#define fof(i,a,b) for(int i = a; i <= b; i++)
#define rev(i,a,b)	for(int i = a; i >= b; i--)
#define in(x) scanf("%d",&x);
#define out(x) printf("%d ",x);
#define endl puts("");

int k,a[nmax],n;

main()
{
in(n);
in(k);
fof(i,1,n)
	a[i]=i;
if(n-1==k) {
	rev(i,n,1)
		out(a[i]);
	}
else if(k==0){
	fof(i,1,n)
		out(a[i]);
	}
else
	{
	int l=1,r=0;
	cout<<1<<" ";
	fof(i,1,k)
		{
		out(a[n-r]);
		if(a[l+1]==a[n-(r+2)])
			{
			out(a[n-(r+1)]);
			out(a[l+1]);
			l+=2;r+=2;
			break;
			}
		out(a[1+l]);
		l++;
		r++;
		}
	fof(i,l+1,n-r)
		out(a[i]);
	}
}


//Turonchik Artur
//include <brain.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <utility>
#include <algorithm>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <time.h>
#include <numeric>

using namespace std;
const int nmax = 1e6+11;
const int maxn = 1108;
const int inf = 1e9+7;

#define fof(i,a,b) for(int i = a; i <= b; i++)
#define rev(i,a,b)	for(int i = a; i >= b; i--)
#define in(x) scanf("%d",&x);
#define out(x) printf("%d ",x);
#define endl puts("");

int k,n;

main()
{
in(n);
in(k);
fof(i,1,k)
	out(n--);
fof(i,1,n)
	out(i);
}


#include<bits/stdc++.h>
#define MAX 100000
using namespace std;
main()
{
    int n,k;
    //cin>>n>>k;
    scanf("%d%d",&n,&k);
//    for(int i = 1;i <= n;++i)perm[i]=i;
    for(int i = k+1;i > 0;--i)
        printf("%d ",i);
    for(int i = k+2;i <= n;++i)
        printf("%d ",i);

}


#include<bits/stdc++.h>
#define MAX 100000
using namespace std;
main()
{
    int n,k;
    cin>>n>>k;
//    for(int i = 1;i <= n;++i)perm[i]=i;
    for(int i = k+1;i > 1;--i)
        cout<<i<<" ";
    cout<<1<<" ";
    for(int i = k+2;i <= n;++i)
        cout<<i<<" ";

}


#include<bits/stdc++.h>
using namespace std;
main()
{
    int n,k;
    cin>>n>>k;
    for(int i = 1;i <=  n;++i)
        if(i == k)
            cout<<i+1<<" ";
        else
            if(i == k+1 && k != 0)
                cout<<i-1<<" ";
        else
            cout<<i<<" ";

}


#include<bits/stdc++.h>
#define MAX 100000
using namespace std;
main()
{
    std::ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
//    for(int i = 1;i <= n;++i)perm[i]=i;
    for(int i = k+1;i >= 1;--i)
        cout<<i<<" ";
    for(int i = k+2;i <= n;++i)
        cout<<i<<" ";

}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
using namespace std;
typedef long long LL;
typedef long long dt;
#define MAXN 500005
#define inf 1e9+7
#define pi acos(-1.0)
#define eps 1e-7
const int Mod=1e9+9;
#define totl 1000000
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define For(k,n) for(int i=k;i<=n;i++)
#define Forj(k,n) for(int j=k;j<=n;j++)
struct node{
    int l,r;
    bool operator < (const node &a)const{
		if(l==a.l) return r<a.r;
		return l<a.l;
    }
	bool operator == (const node &a)const{
		return a.l==l && a.r==r;
	}
};
int n;
node tim[MAXN];
char c;
void solve(){
//	ios::sync_with_stdio(false);
	memset(tim,0,sizeof(tim));
	scanf("%d",&n);
	getchar();
	for(int i=0;i<n;i++){
		int cnt=1;
		while(c=getchar()){
			if(c=='\n') break;
			if(c>='0' && c<='9' && cnt>=0){
				if(cnt==1) tim[i].l*=10,tim[i].l+=c-'0';
				else tim[i].r*=10,tim[i].r+=c-'0';
			}
			if(c==':' && cnt>=0) cnt=0;
			if(c=='m') cnt=-1;
			if(c=='p' && cnt!=-1) cnt=-1,tim[i].l+=12;
		}
	}
	int ans=1,cnt=0;
	node la=tim[0];
	if(la.l==12) la.l=0;
	if(la.l==24) la.l=12;
	for(int i=1;i<n;i++){
		if(tim[i].l==12) tim[i].l=0;
		else if(tim[i].l==24) tim[i].l=12;
		if(tim[i]<la) cnt=0,la=tim[i],ans++;
		else if(tim[i]==la) cnt++;
		else la=tim[i],cnt=0;
		if(cnt>=10) ans++,cnt-=10;
	}
	if(cnt>10) ans++;
	cout<<ans<<endl;
}
int main(){
	int t=10000;
//	while(t--)
		solve();
	int mk;
	if(scanf("%d",&mk)==EOF) return 0;
	return 0;
}
/*
int main(){
	solve();
	int mk;
//	if(scanf("%d",&mk)==EOF) return 0;
	return 0;
}
*/


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
using namespace std;
typedef long long LL;
typedef long long dt;
#define MAXN 500005
#define inf 1e9+7
#define pi acos(-1.0)
#define eps 1e-7
const int Mod=1e9+9;
#define totl 1000000
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define For(k,n) for(int i=k;i<=n;i++)
#define Forj(k,n) for(int j=k;j<=n;j++)
struct node{
    int l,r;
    bool operator < (const node &a)const{
		if(l==a.l) return r<a.r;
		return l<a.l;
    }
	bool operator == (const node &a)const{
		return a.l==l && a.r==r;
	}
};
int n;
node tim[MAXN];
char c;
void solve(){
//	ios::sync_with_stdio(false);
	memset(tim,0,sizeof(tim));
	scanf("%d",&n);
	getchar();
	for(int i=0;i<n;i++){
		int cnt=1;
		while(c=getchar()){
			if(c=='\n') break;
			if(c>='0' && c<='9' && cnt>=0){
				if(cnt==1) tim[i].l*=10,tim[i].l+=c-'0';
				else tim[i].r*=10,tim[i].r+=c-'0';
			}
			if(c==':' && cnt>=0) cnt=0;
			if(c=='m') cnt=-1;
			if(c=='p' && cnt!=-1) cnt=-1,tim[i].l+=12;
		}
	}
	int ans=1,cnt=0;
	node la=tim[0];
	if(la.l==12) la.l=0;
	if(la.l==24) la.l=12;
	for(int i=1;i<n;i++){
		if(tim[i].l==12)
			tim[i].l=0;
		else if(tim[i].l==24) tim[i].l=12;
		if(tim[i]<la)  cnt=0,la=tim[i],ans++;
		else if(tim[i]==la && cnt>=10) ans++,cnt=0;
		else if(tim[i]==la) cnt++;
		else la=tim[i],cnt=0;
	}
	cout<<ans<<endl;
}
int main(){
	int t=10000;
//	while(t--)
		solve();
	int mk;
	if(scanf("%d",&mk)==EOF) return 0;
	return 0;
}
/*
int main(){
	solve();
	int mk;
//	if(scanf("%d",&mk)==EOF) return 0;
	return 0;
}
*/


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
using namespace std;
typedef long long LL;
typedef long long dt;
#define MAXN 500005
#define inf 1e9+7
#define pi acos(-1.0)
#define eps 1e-7
const int Mod=1e9+9;
#define totl 1000000
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define For(k,n) for(int i=k;i<=n;i++)
#define Forj(k,n) for(int j=k;j<=n;j++)
struct node{
    int l,r;
    bool operator < (const node &a)const{
		if(l==a.l) return r<a.r;
		return l<a.l;
    }
	bool operator == (const node &a)const{
		return a.l==l && a.r==r;
	}
};
int n;
node tim[MAXN];
char c;
void solve(){
//	ios::sync_with_stdio(false);
	memset(tim,0,sizeof(tim));
	scanf("%d",&n);
	getchar();
	for(int i=0;i<n;i++){
		int cnt=1;
		while(c=getchar()){
			if(c=='\n') break;
			if(c>='0' && c<='9' && cnt>=0){
				if(cnt==1) tim[i].l*=10,tim[i].l+=c-'0';
				else tim[i].r*=10,tim[i].r+=c-'0';
			}
			if(c==':' && cnt>=0) cnt=0;
			if(c=='m') cnt=-1;
			if(c=='p' && cnt!=-1) cnt=-1,tim[i].l+=12;
		}
	}
	int ans=1,cnt=0;
	node la=tim[0];
	if(la.l==24) la.l=0;
	for(int i=1;i<n;i++){
		if(tim[i].l==24)
			tim[i].l=0;
		if(tim[i]<la)  cnt=0,la=tim[i],ans++;
		else if(tim[i]==la && cnt>=10) ans++,cnt=0;
		else if(tim[i]==la) cnt++;
		else la=tim[i],cnt=0;
	}
	cout<<ans<<endl;
}
int main(){
	int t=10000;
//	while(t--)
		solve();
	int mk;
	if(scanf("%d",&mk)==EOF) return 0;
	return 0;
}
/*
int main(){
	solve();
	int mk;
//	if(scanf("%d",&mk)==EOF) return 0;
	return 0;
}
*/


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
using namespace std;
typedef long long LL;
typedef long long dt;
#define MAXN 500005
#define inf 1e9+7
#define pi acos(-1.0)
#define eps 1e-7
const int Mod=1e9+9;
#define totl 1000000
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define For(k,n) for(int i=k;i<=n;i++)
#define Forj(k,n) for(int j=k;j<=n;j++)
struct node{
    int l,r;
    bool operator < (const node &a)const{
		if(l==a.l) return r<a.r;
		return l<a.l;
    }
	bool operator == (const node &a)const{
		return a.l==l && a.r==r;
	}
};
int n;
node tim[MAXN];
char c;
void solve(){
//	ios::sync_with_stdio(false);
	memset(tim,0,sizeof(tim));
	scanf("%d",&n);
	getchar();
	for(int i=0;i<n;i++){
		int cnt=1;
		while(c=getchar()){
			if(c=='\n') break;
			if(c>='0' && c<='9' && cnt>=0){
				if(cnt==1) tim[i].l*=10,tim[i].l+=c-'0';
				else tim[i].r*=10,tim[i].r+=c-'0';
			}
			if(c==':' && cnt>=0) cnt=0;
			if(c=='m') cnt=-1;
			if(c=='p' && cnt!=-1) cnt=-1,tim[i].l+=12;
		}
	}
	int ans=1,cnt=0;
	node la=tim[0];
	if(la.l==12) la.l=0;
	if(la.l==24) la.l=12;
	for(int i=1;i<n;i++){
		if(tim[i].l==12)
			tim[i].l=0;
		else if(tim[i].l==24) tim[i].l=12;
		if(tim[i]<la)  cnt=0,la=tim[i],ans++;
		else if(tim[i]==la && cnt>=10) ans++,cnt=0;
		else if(tim[i]==la) cnt++;
		else la=tim[i],cnt=0;
	}
	if(cnt>=10) ans++;
	cout<<ans<<endl;
}
int main(){
	int t=10000;
//	while(t--)
		solve();
	int mk;
	if(scanf("%d",&mk)==EOF) return 0;
	return 0;
}
/*
int main(){
	solve();
	int mk;
//	if(scanf("%d",&mk)==EOF) return 0;
	return 0;
}
*/


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
using namespace std;
typedef long long LL;
typedef long long dt;
#define MAXN 500005
#define inf 1e9+7
#define pi acos(-1.0)
#define eps 1e-7
const int Mod=1e9+9;
#define totl 1000000
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define For(k,n) for(int i=k;i<=n;i++)
#define Forj(k,n) for(int j=k;j<=n;j++)
struct node{
    int l,r;
    bool operator < (const node &a)const{
		if(l==a.l) return r<a.r;
		return l<a.l;
    }
	bool operator == (const node &a)const{
		return a.l==l && a.r==r;
	}
};
int n;
node tim[MAXN];
char c;
void solve(){
//	ios::sync_with_stdio(false);
	memset(tim,0,sizeof(tim));
	scanf("%d",&n);
	getchar();
	for(int i=0;i<n;i++){
		int cnt=1;
		while(c=getchar()){
			if(c=='\n') break;
			if(c>='0' && c<='9' && cnt>=0){
				if(cnt==1) tim[i].l*=10,tim[i].l+=c-'0';
				else tim[i].r*=10,tim[i].r+=c-'0';
			}
			if(c==':' && cnt>=0) cnt=0;
			if(c=='m') cnt=-1;
			if(c=='p' && cnt!=-1) cnt=-1,tim[i].l+=12;
		}
	}
	int ans=1,cnt=0;
	node la=tim[0];
	if(la.l==24 || la.l==12) la.l=0;
	for(int i=1;i<n;i++){
		if(tim[i].l==24 || tim[i].l==12)
			tim[i].l=0;
		if(tim[i]<la)  cnt=0,la=tim[i],ans++;
		else if(tim[i]==la && cnt>=10) ans++,cnt=0;
		else if(tim[i]==la) cnt++;
		else la=tim[i],cnt=0;
	}
	cout<<ans<<endl;
}
int main(){
	int t=10000;
//	while(t--)
		solve();
	int mk;
	if(scanf("%d",&mk)==EOF) return 0;
	return 0;
}
/*
int main(){
	solve();
	int mk;
//	if(scanf("%d",&mk)==EOF) return 0;
	return 0;
}
*/


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
using namespace std;
typedef long long LL;
typedef long long dt;
#define MAXN 500005
#define inf 1e9+7
#define pi acos(-1.0)
#define eps 1e-7
const int Mod=1e9+9;
#define totl 1000000
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define For(k,n) for(int i=k;i<=n;i++)
#define Forj(k,n) for(int j=k;j<=n;j++)
struct node{
    int l,r;
    bool operator < (const node &a)const{
		if(l==a.l) return r<a.r;
		return l<a.l;
    }
	bool operator == (const node &a)const{
		return a.l==l && a.r==r;
	}
};
int n;
node tim[MAXN];
char c;
void solve(){
//	ios::sync_with_stdio(false);
	memset(tim,0,sizeof(tim));
	scanf("%d",&n);
	getchar();
	for(int i=0;i<n;i++){
		int cnt=1;
		while(c=getchar()){
			if(c=='\n') break;
			if(c>='0' && c<='9' && cnt>=0){
				if(cnt==1) tim[i].l*=10,tim[i].l+=c-'0';
				else tim[i].r*=10,tim[i].r+=c-'0';
			}
			if(c==':' && cnt>=0) cnt=0;
			if(c=='m') cnt=-1;
			if(c=='p' && cnt!=-1) cnt=-1,tim[i].l+=12;
		}
	}
	int ans=1,cnt=0;
	node la=tim[0];
	if(la.l==12) la.l=0;
	if(la.l==24) la.l=12;
	for(int i=1;i<n;i++){
		if(tim[i].l==12) tim[i].l=0;
		else if(tim[i].l==24) tim[i].l=12;
		if(tim[i]<la) cnt=0,la=tim[i],ans++;
		else if(tim[i]==la) ans++;
		else if(tim[i]==la) cnt++;
		else la=tim[i],cnt=0;
		if(cnt>=10) ans++,cnt-=10;
	}
	if(cnt>10) ans++;
	cout<<ans<<endl;
}
int main(){
	int t=10000;
//	while(t--)
		solve();
	int mk;
	if(scanf("%d",&mk)==EOF) return 0;
	return 0;
}
/*
int main(){
	solve();
	int mk;
//	if(scanf("%d",&mk)==EOF) return 0;
	return 0;
}
*/


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 100);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				c2++;
				if(c2>10)
				{
					contor++;
					c2=1;
				}
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 100);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
			contor++;
		else
		{
			if(!am[i] && am[i-1])
			{
				c2++;
				if(c2>10)
				{
					contor++;
					c2=1;
				}
				continue;
			}
			if(nr1[i]<nr1[i-1])
				contor++;
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
					contor++;
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 100);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
					am[i]=true;
				break;
			}
		}
	}
	contor=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
			contor++;
		else
		{
			if(!am[i] && am[i-1])
				continue;
			if(nr1[i]<nr1[i-1])
				contor++;
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
					contor++;
			}
		}
	}
	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[501];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 500);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=0;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				continue;
			}
			if(am[i] && !am[i-1])
			{
				contor++;
				c2=0;
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=0;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=0;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=0;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[501];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 500);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 100);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[501];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 500);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=0;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=0;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				continue;
			}
			if(am[i] && !am[i-1])
			{
				contor++;
				c2=0;
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=0;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=0;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 500);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				c2++;
				if(c2>10)
				{
					contor++;
					c2=1;
				}
				continue;
			}
			if(am[i] && !am[i-1])
			{
				contor++;
				c2=1;
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
			else
			{
				c2++;
				if(c2>10)
				{
					contor++;
					c2=1;
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 100);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				c2++;
				if(c2>10)
				{
					contor++;
					c2=1;
				}
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
			else
			{
				c2++;
				if(c2>10)
				{
					contor++;
					c2=1;
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[501];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 500);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				continue;
			}
			if(am[i]!=am[i-1])
				continue;
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[501];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 500);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				c2=1;
				continue;
			}
			if(am[i]!=am[i-1])
			{
				c2=1;
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else if(nr2[i]==nr2[i-1])
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
				else
				{
					c2=1;
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 100);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				c2++;
				if(c2>10)
				{
					contor++;
					c2=1;
				}
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 100);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				c2++;
				if(c2>10)
				{
					contor++;
					c2=1;
				}
				continue;
			}
			if(am[i] && !am[i-1])
			{
				contor++;
				c2=1;
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
			else
			{
				c2++;
				if(c2>10)
				{
					contor++;
					c2=1;
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 100);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				continue;
			}
			if(am[i] && !am[i-1])
			{
				contor++;
				c2=1;
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[501];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 500);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				continue;
			}
			if(am[i]!=am[i-1])
				continue;
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else if(nr2[i]==nr2[i-1])
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[501];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 500);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				continue;
			}
			if(am[i] && !am[i-1])
			{
				contor++;
				c2=1;
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 100);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				continue;
			}
			if(am[i] && !am[i-1])
			{
				contor++;
				c2=1;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
			else
			{
				c2=1;
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 100);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				break;
			}
		}
	}
	contor=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
			contor++;
		else
		{
			if(!am[i] && am[i-1])
				continue;
			if(nr1[i]<nr1[i-1])
				contor++;
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
					contor++;
			}
		}
	}
	cout<<contor;
}


#include <fstream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];
ifstream cin("in.txt");
ofstream cout("out.txt");
int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 100);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				break;
			}
		}
	}
	contor=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
			contor++;
		else
		{
			if(!am[i] && am[i-1])
				continue;
			if(nr1[i]<nr1[i-1])
				contor++;
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
					contor++;
			}
		}
	}
	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[501];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 500);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				c2=1;
				continue;
			}
			if(am[i]!=am[i-1])
			{
				c2=1;
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else if(nr2[i]==nr2[i-1])
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
				else
				{
					c2=1;
				}
			}
			else
				c2=1;
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[501];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 500);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=0;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				continue;
			}
			if(am[i] && !am[i-1])
			{
				contor++;
				c2=0;
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=0;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=0;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[501];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 500);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=0;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=0;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				continue;
			}
			if(am[i] && !am[i-1])
			{
				contor++;
				c2=0;
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=0;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=0;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=0;
					}
				}
			}
		}
	}

	cout<<contor;
}


#include <iostream>
#include <cstring>
using namespace std;
int n, contor;
char x[201];
int i, j, nr1[101], nr2[101];
bool am[101];

int main()
{
	cin>>n;
	cin.getline(x, 10);
	for(i=1; i<=n; i++)
	{
		cin.getline(x, 100);
		int p=strlen(x);
		for(j=0; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr1[i]=nr1[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isdigit(x[j]))
			{
				while(isdigit(x[j]))
				{
					nr2[i]=nr2[i]*10+(x[j]-48);
					j++;
				}
				break;
			}
		}
		for(j=j+1; j<p; j++)
		{
			if(isalpha(x[j]))
			{
				if(x[j]=='a')
				{
					if(nr1[i]==12)
					{
						nr1[i]=0;
					}
					am[i]=true;
				}
				else if(nr1[i]==12)
					nr1[i]=0;
				break;
			}
		}
	}
	contor=1;
	int c2=1;
	for(i=2; i<=n; i++)
	{
		if(am[i] && !am[i-1])
		{
			contor++;
			c2=1;
		}
		else
		{
			if(!am[i] && am[i-1])
			{
				continue;
			}
			if(nr1[i]<nr1[i-1])
			{
				c2=1;
				contor++;
			}
			else if(nr1[i]==nr1[i-1])
			{
				if(nr2[i]<nr2[i-1])
				{
					c2=1;
					contor++;
				}
				else
				{
					c2++;
					if(c2>10)
					{
						contor++;
						c2=1;
					}
				}
			}
			else
			{
				c2=1;
			}
		}
	}

	cout<<contor;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:"){
            if( hh == 12 ){
                tot = mm;
            }
            else{
               tot = hh*60 + mm;
            }
        }
        else{
            if( hh == 12 )
                tot = hh *60 + mm;
            else
                tot = (hh+12)*60 + mm;
        }

        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << p << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    int hast = 0;
    For(i,1,n){
//        cout << v[i].tot << "  dfj" << endl;
        if(v[i].tot < v[i-1].tot ){
            cont++;
            hast = 1;
        }
        else{
            hast++;
            if( hast > 10 ){
                hast = 1;
                cont++;
            }
        }
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:"){
            if( hh == 12 ){
                tot = mm;
            }
            else{
               tot = hh*60 + mm;
            }
        }
        else
            tot = (hh+12)*60 + mm;
        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    char message[150];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << message << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    For(i,1,n){
        if(v[i].tot < v[i-1].tot ){
            cont++;
        }
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:"){
            if( hh = 12 ){
                tot = mm;
            }
            else{
               tot = hh*60 + mm;
            }
        }
        else
            tot = (hh+12)*60 + mm;
        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    char message[150];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << message << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    For(i,1,n){
        if(v[i].tot < v[i-1].tot ){
            cont++;
        }
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:")
            tot = hh*60 + mm;
        else
            tot = (hh+12)*60 + mm;
        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    char message[150];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << message << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    For(i,1,n){
        if(v[i].tot < v[i-1].tot ){
            cont++;
        }
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:"){
            if( hh == 12 ){
                tot = mm;
            }
            else{
               tot = hh*60 + mm;
            }
        }
        else{
            if( hh == 12 )
                tot = hh *60 + mm;
            else
                tot = (hh+12)*60 + mm;
        }

        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << p << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    int hast = 0;
    For(i,1,n){
        cout << v[i].tot << "  dfj" << endl;
        if(v[i].tot < v[i-1].tot ){
            cont++;
            hast = 0;
        }
        else{
            hast++;
            if( hast == 10 ){
                hast = 0;
                cont++;
            }
        }
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:"){
            if( hh == 12 ){
                tot = mm;
            }
            else{
               tot = hh*60 + mm;
            }
        }
        else{
            if( hh == 12 )
                tot = hh *60 + mm;
            else
                tot = (hh+12)*60 + mm;
        }

        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << p << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    int hast = 0;
    For(i,1,n){
//        cout << v[i].tot << "  dfj" << endl;
        if(v[i].tot < v[i-1].tot ){
            cont++;
            hast = 0;
        }
        else{
            hast++;
            if( hast == 10 ){
                hast = 0;
                cont++;
            }
        }
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:"){
            if( hh == 12 ){
                tot = mm;
            }
            else{
               tot = hh*60 + mm;
            }
        }
        else{
            if( hh == 12 )
                tot = hh *60 + mm;
            else
                tot = (hh+12)*60 + mm;
        }

        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << p << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    int same = 1;
    int last = v[0].tot;
    For(i,1,n){
//        cout << v[i].tot << "  dfj" << endl;
        if(v[i].tot < v[i-1].tot ){
            cont++;
        }
        else{
            if( last == v[i].tot )
                same++;
            else
                same = 0;
        }
        if( same > 10 ){
            cont++;
            same = 1;
        }
        last = v[i].tot;
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:"){
            if( hh == 12 ){
                tot = mm;
            }
            else{
               tot = hh*60 + mm;
            }
        }
        else{
            if( hh == 12 )
                tot = hh *60 + mm;
            else
                tot = (hh+12)*60 + mm;
        }

        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << p << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    int hast = 0;
    For(i,1,n){
//        cout << v[i].tot << "  dfj" << endl;
        if(v[i].tot < v[i-1].tot ){
            cont++;
            hast = 0;
        }
        else{
            hast++;
            if( hast > 10 ){
                hast = 1;
                cont++;
            }
        }
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:"){
            if( hh == 12 ){
                tot = mm;
            }
            else{
               tot = hh*60 + mm;
            }
        }
        else{
            if( hh == 12 )
                tot = hh *60 + mm;
            else
                tot = (hh+12)*60 + mm;
        }

        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << p << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    int same = 0;
    int last = v[0].tot;
    For(i,1,n){
//        cout << v[i].tot << "  dfj" << endl;
        if(v[i].tot < v[i-1].tot ){
            cont++;
        }
        else{
            if( last == v[i].tot )
                same++;
            else
                same = 0;
        }
        if( same > 10 ){
            cont++;
            same = 1;
        }
        last = v[i].tot;
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:"){
            if( hh == 12 ){
                tot = mm;
            }
            else{
               tot = hh*60 + mm;
            }
        }
        else{
            if( hh == 12 )
                tot = hh *60 + mm;
            else
                tot = (hh+12)*60 + mm;
        }

        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << p << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    int same = 1;
    int last = v[0].tot;
    For(i,1,n){
//        cout << v[i].tot << "  dfj" << endl;
        if(v[i].tot < v[i-1].tot ){
            cont++;
            same = 1;
        }
        else{
            if( last == v[i].tot )
                same++;
            else
                same = 1;
        }
        if( same > 10 ){
            cont++;
            same = 1;
        }
        last = v[i].tot;
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:"){
            if( hh == 12 ){
                tot = mm;
            }
            else{
               tot = hh*60 + mm;
            }
        }
        else{
            if( hh == 12 )
                tot = hh *60 + mm;
            else
                tot = (hh+12)*60 + mm;
        }

        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    char message[150];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << message << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    For(i,1,n){
        if(v[i].tot < v[i-1].tot ){
            cont++;
        }
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:")
            tot = hh*60 + mm;
        else
            tot = (hh+12)*60 + mm;
        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    char message[150];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << message << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    For(i,1,n){
        if(v[i].tot < v[i-1].tot ){
            cont++;
        }
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:"){
            if( hh == 12 ){
                tot = mm;
            }
            else{
               tot = hh*60 + mm;
            }
        }
        else{
            if( hh == 12 )
                tot = hh *60 + mm;
            else
                tot = (hh+12)*60 + mm;
        }

        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << p << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    int hast = 0;
    For(i,1,n){
//        cout << v[i].tot << "  dfj" << endl;
        if(v[i].tot < v[i-1].tot ){
            cont++;
            hast = 0;
        }
        else{
            hast++;
            if( hast > 10 ){
                hast = 0;
                cont++;
            }
        }
    }
    cout << cont << endl;
    return 0;
}


// D by dANNY vIOREL eSPEJO
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<string>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define F(i,a) for(int i=0;i<(a);i++)
#define All(x)  x.begin(),x.end()
#define llena(x) F(i,x.size())cin>>x[i]
#define pb push_back
#define S size()
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
struct hora{
    int h, m, tot;
    string tm;
    hora(int hh, int mm, string ttm){
        if( ttm == "a.m.]:"){
            if( hh == 12 ){
                tot = mm;
            }
            else{
               tot = hh*60 + mm;
            }
        }
        else{
            if( hh == 12 )
                tot = hh *60 + mm;
            else
                tot = (hh+12)*60 + mm;
        }

        h = hh, m = mm, tm = ttm;
    }
};
int main(){
    int n,casos;
    int h, m;
    char tm[6];
    vector<hora> v;
    scanf("%d\n", &n);
    F(i,n){
        scanf("[%d:%d %s", &h, &m, &tm);
        string p;
        getline(cin,p);
//        cout << "h = " << h << ", m = " << m << ", tm = " << tm << ", message = " << p << endl;
        string s(tm);
        v.pb(hora(h,m,s));
    }
    int cont = 1;
    int same = 1;
    int last = v[0].tot;
    For(i,1,n){
//        cout << v[i].tot << "  dfj" << endl;
        if(v[i].tot < v[i-1].tot ){
            cont++;
            same = 0;
        }
        else{
            if( last == v[i].tot )
                same++;
            else
                same = 0;
        }
        if( same > 10 ){
            cont++;
            same = 1;
        }
        last = v[i].tot;
    }
    cout << cont << endl;
    return 0;
}


#include <iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)>(y)?(x):(y))
using namespace std;
char s[10000];
int main()
{
	int m,n,i,x,y,prex=-1,prey=-1,ans,cnt=1;
	scanf("%d",&n);
	gets(s);
	ans=1;
	for(i=0;i<n;i++)
	{
		gets(s);
		x=(s[1]-'0')*10+s[2]-'0';
		y=(s[4]-'0')*10+s[5]-'0';
		if(s[7]=='p') x+=12;
		if(s[7]=='a'&&x==12) x=0;
		if(x==prex&&y==prey) cnt++;
		if(x<prex||x==prex&&y<prey||cnt==11)
		{
			ans++;
			cnt=1;
		}
		prex=x; prey=y;
	}
	printf("%d\n",ans);
}


#include <iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)>(y)?(x):(y))
using namespace std;
char s[10000];
int main()
{
	int m,n,i,x,y,prex=-1,prey=-1,ans,cnt=1;
	scanf("%d",&n);
	gets(s);
	ans=1;
	for(i=0;i<n;i++)
	{
		gets(s);
		x=(s[1]-'0')*10+s[2]-'0';
		y=(s[4]-'0')*10+s[5]-'0';
		if(s[7]=='p') x+=12;
		if(s[7]=='a'&&x==12) x=0;
		if(x==prex&&y==prey) cnt++;
		else cnt=1;
		if(x<prex||x==prex&&y<prey||cnt==11)
		{
			ans++;
			cnt=1;
		}
		prex=x; prey=y;
	}
	printf("%d\n",ans);
}


#include <iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)>(y)?(x):(y))
using namespace std;
char s[10000];
int main()
{
	int m,n,i,x,y,prex=-1,prey=-1,ans,cnt=1;
	scanf("%d",&n);
	gets(s);
	ans=1;
	for(i=0;i<n;i++)
	{
		gets(s);
		x=(s[1]-'0')*10+s[2]-'0';
		y=(s[4]-'0')*10+s[5]-'0';
		if(s[7]=='p') x+=12;
		if(x==12) x=0;
		if(x==prex&&y==prey) cnt++;
		else cnt=1;
		if(x<prex||x==prex&&y<prey||cnt==11)
		{
			ans++;
			cnt=1;
		}
		prex=x; prey=y;
	}
	printf("%d\n",ans);
}


#include <iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)>(y)?(x):(y))
using namespace std;
char s[10000];
int main()
{
	int m,n,i,x,y,prex=-1,prey=-1,ans;
	scanf("%d",&n);
	gets(s);
	ans=1;
	for(i=0;i<n;i++)
	{
		gets(s);
		x=(s[1]-'0')*10+s[2]-'0';
		y=(s[4]-'0')*10+s[5]-'0';
		if(s[7]=='p') x+=12;
		if(x<prex||x==prex&&y<prey)
			ans++;
		prex=x; prey=y;
	}
	printf("%d\n",ans);
}


#include <iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)>(y)?(x):(y))
using namespace std;
char s[10000];
int main()
{
	int m,n,i,x,y,prex=-1,prey=-1,ans;
	scanf("%d",&n);
	gets(s);
	ans=1;
	for(i=0;i<n;i++)
	{
		gets(s);
		x=(s[1]-'0')*10+s[2]-'0';
		y=(s[4]-'0')*10+s[5]-'0';
		if(s[7]=='p') x+=12;
		if(s[7]=='a'&&x==12) x=0;
		if(x<prex||x==prex&&y<prey)
			ans++;
		prex=x; prey=y;
	}
	printf("%d\n",ans);
}


#include <iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)>(y)?(x):(y))
using namespace std;
char s[10000];
int main()
{
	int m,n,i,x,y,prex=-1,prey=-1,ans,cnt=1;
	scanf("%d",&n);
	gets(s);
	ans=1;
	for(i=0;i<n;i++)
	{
		gets(s);
		x=(s[1]-'0')*10+s[2]-'0';
		y=(s[4]-'0')*10+s[5]-'0';
		if(x==12) x-=12;
		if(s[7]=='p') x+=12;
		if(x==prex&&y==prey) cnt++;
		else cnt=1;
		if(x<prex||x==prex&&y<prey||cnt==11)
		{
			ans++;
			cnt=1;
		}
		prex=x; prey=y;
	}
	printf("%d\n",ans);
}


/*
First drop, first untied knot
Long lost time unveiling its lies
Waiting for inevitable
Only rise to fall
When these days are like yesterdays
I'm too proud to feel the same
Welcome here where it all ends
My hopes, my fears, my dreams

So silent after rain, so calm the dawn
The day so pale, I'll pray for mercy for the last time

There is

Hell for me to feel, for me to hear
Hell for me to kneel, for me to sear

In the eye of the blind for the last time
All the words of the numb to hear
Glimpses of past too shallow to last
These fragments too hollow to feel

To hear, to feel, to sear

Last drop, last untied knot
Time to unleash all demons inside
Waiting here for the last lines
I'll close my eyes
*/

//#pragma comment(linker, "/STACK:16777216")
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>

#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash

#define  INF 100000000
#define eps 1e-11
//#define M_PI 3.141592653589793
//#define mx 1000000000000ll
#define bs 1000000007
#define bsize 256

using namespace std;

long tests;
string st;
long t1,timee;
long ans;
long calc;

long eval(string st)
{
 long h,m;
 h=st[1]-48;
 h=h*10+st[2]-48;
 m=st[4]-48;
 m=m*10+st[5]-48;
 if (h==12){if (st[7]=='a')return 0;}
 if (st[7]=='p'&&h<12)h+=12;
 return h*60+m;
}

int main(){
//freopen("sufflcp.in","r",stdin);
//freopen("sufflcp.out","w",stdout);
//freopen("C:/input.txt","r",stdin);
//freopen("C:/output.txt","w",stdout);
ios_base::sync_with_stdio(0);
//cin.tie(0);

++ans;
cin>>tests;
timee=0;
getline(cin,st);
for (;tests;--tests)
{
 getline(cin,st);
 t1=eval(st);
 if (t1<timee){++ans;calc=1;}
 if (t1==timee){++calc;if (calc==11){++ans,calc=1;}}
 if (t1>timee)calc=1;
 timee=t1;
}
cout<<ans<<endl;

cin.get();cin.get();
return 0;}


/*
First drop, first untied knot
Long lost time unveiling its lies
Waiting for inevitable
Only rise to fall
When these days are like yesterdays
I'm too proud to feel the same
Welcome here where it all ends
My hopes, my fears, my dreams

So silent after rain, so calm the dawn
The day so pale, I'll pray for mercy for the last time

There is

Hell for me to feel, for me to hear
Hell for me to kneel, for me to sear

In the eye of the blind for the last time
All the words of the numb to hear
Glimpses of past too shallow to last
These fragments too hollow to feel

To hear, to feel, to sear

Last drop, last untied knot
Time to unleash all demons inside
Waiting here for the last lines
I'll close my eyes
*/

//#pragma comment(linker, "/STACK:16777216")
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>

#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash

#define  INF 100000000
#define eps 1e-11
//#define M_PI 3.141592653589793
//#define mx 1000000000000ll
#define bs 1000000007
#define bsize 256

using namespace std;

long tests;
string st;
long t1,timee;
long ans;

long eval(string st)
{
 long h,m;
 h=st[1]-48;
 h=h*10+st[2]-48;
 m=st[4]-48;
 m=m*10+st[5]-48;
 if (st[7]=='p')h+=12;
 return h*60+m;
}

int main(){
//freopen("sufflcp.in","r",stdin);
//freopen("sufflcp.out","w",stdout);
//freopen("C:/input.txt","r",stdin);
//freopen("C:/output.txt","w",stdout);
ios_base::sync_with_stdio(0);
//cin.tie(0);

++ans;
cin>>tests;
timee=0;
getline(cin,st);
for (;tests;--tests)
{
 getline(cin,st);
 t1=eval(st);
 if (t1<timee){++ans;}
 timee=t1;
}
cout<<ans<<endl;

cin.get();cin.get();
return 0;}


/*
First drop, first untied knot
Long lost time unveiling its lies
Waiting for inevitable
Only rise to fall
When these days are like yesterdays
I'm too proud to feel the same
Welcome here where it all ends
My hopes, my fears, my dreams

So silent after rain, so calm the dawn
The day so pale, I'll pray for mercy for the last time

There is

Hell for me to feel, for me to hear
Hell for me to kneel, for me to sear

In the eye of the blind for the last time
All the words of the numb to hear
Glimpses of past too shallow to last
These fragments too hollow to feel

To hear, to feel, to sear

Last drop, last untied knot
Time to unleash all demons inside
Waiting here for the last lines
I'll close my eyes
*/

//#pragma comment(linker, "/STACK:16777216")
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>

#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash

#define  INF 100000000
#define eps 1e-11
//#define M_PI 3.141592653589793
//#define mx 1000000000000ll
#define bs 1000000007
#define bsize 256

using namespace std;

long tests;
string st;
long t1,timee;
long ans;
long calc;

long eval(string st)
{
 long h,m;
 h=st[1]-48;
 h=h*10+st[2]-48;
 m=st[4]-48;
 m=m*10+st[5]-48;
 if (h==12){if (st[7]=='a')return 0; return 480;}
 if (st[7]=='p')h+=12;
 return h*60+m;
}

int main(){
//freopen("sufflcp.in","r",stdin);
//freopen("sufflcp.out","w",stdout);
//freopen("C:/input.txt","r",stdin);
//freopen("C:/output.txt","w",stdout);
ios_base::sync_with_stdio(0);
//cin.tie(0);

++ans;
cin>>tests;
timee=0;
getline(cin,st);
for (;tests;--tests)
{
 getline(cin,st);
 t1=eval(st);
 if (t1<timee){++ans;calc=1;}
 if (t1==timee){++calc;if (calc==11)++ans,calc=1;}
 if (t1>timee)calc=1;
 timee=t1;
}
cout<<ans<<endl;

cin.get();cin.get();
return 0;}


/*
First drop, first untied knot
Long lost time unveiling its lies
Waiting for inevitable
Only rise to fall
When these days are like yesterdays
I'm too proud to feel the same
Welcome here where it all ends
My hopes, my fears, my dreams

So silent after rain, so calm the dawn
The day so pale, I'll pray for mercy for the last time

There is

Hell for me to feel, for me to hear
Hell for me to kneel, for me to sear

In the eye of the blind for the last time
All the words of the numb to hear
Glimpses of past too shallow to last
These fragments too hollow to feel

To hear, to feel, to sear

Last drop, last untied knot
Time to unleash all demons inside
Waiting here for the last lines
I'll close my eyes
*/

//#pragma comment(linker, "/STACK:16777216")
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>

#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash

#define  INF 100000000
#define eps 1e-11
//#define M_PI 3.141592653589793
//#define mx 1000000000000ll
#define bs 1000000007
#define bsize 256

using namespace std;

long tests;
string st;
long t1,timee;
long ans;

long eval(string st)
{
 long h,m;
 h=st[1]-48;
 h=h*10+st[2]-48;
 m=st[4]-48;
 m=m*10+st[5]-48;
 if (h==12){if (st[7]=='a')return 0; return 480;}
 if (st[7]=='p')h+=12;
 return h*60+m;
}

int main(){
//freopen("sufflcp.in","r",stdin);
//freopen("sufflcp.out","w",stdout);
//freopen("C:/input.txt","r",stdin);
//freopen("C:/output.txt","w",stdout);
ios_base::sync_with_stdio(0);
//cin.tie(0);

++ans;
cin>>tests;
timee=0;
getline(cin,st);
for (;tests;--tests)
{
 getline(cin,st);
 t1=eval(st);
 if (t1<timee){++ans;}
 timee=t1;
}
cout<<ans<<endl;

cin.get();cin.get();
return 0;}


/*
First drop, first untied knot
Long lost time unveiling its lies
Waiting for inevitable
Only rise to fall
When these days are like yesterdays
I'm too proud to feel the same
Welcome here where it all ends
My hopes, my fears, my dreams

So silent after rain, so calm the dawn
The day so pale, I'll pray for mercy for the last time

There is

Hell for me to feel, for me to hear
Hell for me to kneel, for me to sear

In the eye of the blind for the last time
All the words of the numb to hear
Glimpses of past too shallow to last
These fragments too hollow to feel

To hear, to feel, to sear

Last drop, last untied knot
Time to unleash all demons inside
Waiting here for the last lines
I'll close my eyes
*/

//#pragma comment(linker, "/STACK:16777216")
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>

#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash

#define  INF 100000000
#define eps 1e-11
//#define M_PI 3.141592653589793
//#define mx 1000000000000ll
#define bs 1000000007
#define bsize 256

using namespace std;

long tests;
string st;
long t1,timee;
long ans;
long calc;

long eval(string st)
{
 long h,m;
 h=st[1]-48;
 h=h*10+st[2]-48;
 m=st[4]-48;
 m=m*10+st[5]-48;
 if (h==12){h-=12;}
 if (st[7]=='p')h+=12;
 return h*60+m;
}

int main(){
//freopen("sufflcp.in","r",stdin);
//freopen("sufflcp.out","w",stdout);
//freopen("C:/input.txt","r",stdin);
//freopen("C:/output.txt","w",stdout);
ios_base::sync_with_stdio(0);
//cin.tie(0);

++ans;
cin>>tests;
timee=0;
getline(cin,st);
for (;tests;--tests)
{
 getline(cin,st);
 t1=eval(st);
 if (t1<timee){++ans;calc=1;}
 if (t1==timee){++calc;if (calc==11){++ans,calc=1;}}
 if (t1>timee)calc=1;
 timee=t1;
}
cout<<ans<<endl;

cin.get();cin.get();
return 0;}


/*
First drop, first untied knot
Long lost time unveiling its lies
Waiting for inevitable
Only rise to fall
When these days are like yesterdays
I'm too proud to feel the same
Welcome here where it all ends
My hopes, my fears, my dreams

So silent after rain, so calm the dawn
The day so pale, I'll pray for mercy for the last time

There is

Hell for me to feel, for me to hear
Hell for me to kneel, for me to sear

In the eye of the blind for the last time
All the words of the numb to hear
Glimpses of past too shallow to last
These fragments too hollow to feel

To hear, to feel, to sear

Last drop, last untied knot
Time to unleash all demons inside
Waiting here for the last lines
I'll close my eyes
*/

//#pragma comment(linker, "/STACK:16777216")
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>

#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash

#define  INF 100000000
#define eps 1e-11
//#define M_PI 3.141592653589793
//#define mx 1000000000000ll
#define bs 1000000007
#define bsize 256

using namespace std;

long tests;
string st;
long t1,timee;
long ans;
long calc;

long eval(string st)
{
 long h,m;
 h=st[1]-48;
 h=h*10+st[2]-48;
 m=st[4]-48;
 m=m*10+st[5]-48;
 if (h==12){if (st[7]=='a')return 0; return 480;}
 if (st[7]=='p')h+=12;
 return h*60+m;
}

int main(){
//freopen("sufflcp.in","r",stdin);
//freopen("sufflcp.out","w",stdout);
//freopen("C:/input.txt","r",stdin);
//freopen("C:/output.txt","w",stdout);
ios_base::sync_with_stdio(0);
//cin.tie(0);

++ans;
cin>>tests;
timee=0;
getline(cin,st);
for (;tests;--tests)
{
 getline(cin,st);
 t1=eval(st);
 if (t1<timee){++ans;calc=1;}
 if (t1==timee){++calc;if (calc==10)++ans,calc=1;}
 if (t1>timee)calc=1;
 timee=t1;
}
cout<<ans<<endl;

cin.get();cin.get();
return 0;}


/*
Author : OmarEl-Mohandes
PROG   : D
LANG   : C++
*/
#include <map>
#include <string>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <memory.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz size()
#define rep(i,m) for(int i=0;i<m;i++)
#define REP(i,k,m) for(int i=k;i<m;i++)
#define mem(a,b) memset(a,b,sizeof(a))
#define mp make_pair
typedef stringstream ss;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef unsigned long long ll;
#define oo ((int)1e9)
int main()
{
	//freopen("test.in" , "rt" , stdin);
	//freopen("D.out" , "wt" , stdout);
	int n;
	cin >> n;
	string s;
	getline(cin , s);
	int mn , hr , td = 0 , res = 0;
	bool am;
	vector<pair<bool , int> > al;
	rep(i , n)
	{
		getline(cin , s);
		hr = atoi(s.substr(1 , 2).c_str())%12;
		mn = atoi(s.substr(4 , 2).c_str());
		am = s[7]=='a';
		hr+=(am?0:12);
		al.pb(mp(am , hr * 60 + mn));
	}
	int i = 0;
	while(i < n)
	{
		mn = al[i].second;
		td = 0;
		while(i < n)
		{
			if(mn == al[i].second && td == 10)
				break;
			else if(mn > al[i].second)
				break;

			if(mn == al[i].second)
				td ++;
			else
				td = 1;
			mn = al[i].second;
			i ++;
		}
		res ++;
	}
	cout << res << endl;
	return 0;
}


/*
Author : OmarEl-Mohandes
PROG   : D
LANG   : C++
*/
#include <map>
#include <string>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <memory.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz size()
#define rep(i,m) for(int i=0;i<m;i++)
#define REP(i,k,m) for(int i=k;i<m;i++)
#define mem(a,b) memset(a,b,sizeof(a))
#define mp make_pair
typedef stringstream ss;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef unsigned long long ll;
#define oo ((int)1e9)
int main()
{
    //freopen("test.in" , "rt" , stdin);
    //freopen("D.out" , "wt" , stdout);
    int n;
    cin >> n;
    string s;
    getline(cin , s);
    int mn , hr , td = 0 , res = 0;
    bool am;
    rep(i , n)
    {
        getline(cin , s);
        if(i == 0)
        {
            hr = atoi(s.substr(1 , 2).c_str());
            mn = atoi(s.substr(4 , 2).c_str());
            am = s[7]=='a';
            res ++;
            td ++;
            continue;
        }
        int h = atoi(s.substr(1 , 2).c_str());
        int m = atoi(s.substr(4 , 2).c_str());
        bool a = s[7] == 'a';
        if(am == a && (hr < h || (hr == h && mn <= m)))
            td ++;
        else if(am && !a)
        {
            td ++;
        }
        else
        {
            td = 0;
            res ++;
        }
        hr = h;
        mn = m;
        am = a;
        if(td > 10)
        {
            td = 0;
            res ++;
        }
    }
    cout << res << endl;
    return 0;
}


/*
Author : OmarEl-Mohandes
PROG   : D
LANG   : C++
*/
#include <map>
#include <string>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <memory.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz size()
#define rep(i,m) for(int i=0;i<m;i++)
#define REP(i,k,m) for(int i=k;i<m;i++)
#define mem(a,b) memset(a,b,sizeof(a))
#define mp make_pair
typedef stringstream ss;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef unsigned long long ll;
#define oo ((int)1e9)
int main()
{
    //freopen("test.in" , "rt" , stdin);
    //freopen("D.out" , "wt" , stdout);
    int n;
    cin >> n;
    string s;
    getline(cin , s);
    int mn , hr , td = 0 , res = 0;
    bool am;
    rep(i , n)
    {
        getline(cin , s);
        if(i == 0)
        {
            hr = atoi(s.substr(1 , 2).c_str());
            mn = atoi(s.substr(4 , 2).c_str());
            am = s[7]=='a';
            res ++;
            td ++;
            continue;
        }
        int h = atoi(s.substr(1 , 2).c_str());
        int m = atoi(s.substr(4 , 2).c_str());
        bool a = s[7] == 'a';
        if(am == a && hr <= h && mn <= m)
            td ++;
        else if(am && !a)
        {
            td ++;
        }
        else
        {
            td = 0;
            res ++;
        }
        hr = h;
        mn = m;
        am = a;
        if(td > 10)
        {
            td = 0;
            res ++;
        }
    }
    cout << res << endl;
    return 0;
}


/*
Author : OmarEl-Mohandes
PROG   : D
LANG   : C++
*/
#include <map>
#include <string>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <memory.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz size()
#define rep(i,m) for(int i=0;i<m;i++)
#define REP(i,k,m) for(int i=k;i<m;i++)
#define mem(a,b) memset(a,b,sizeof(a))
#define mp make_pair
typedef stringstream ss;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef unsigned long long ll;
#define oo ((int)1e9)
int main()
{
    //freopen("test.in" , "rt" , stdin);
    //freopen("D.out" , "wt" , stdout);
    int n;
    cin >> n;
    string s;
    getline(cin , s);
    int mn , hr , td = 0 , res = 0;
    bool am;
    rep(i , n)
    {
        getline(cin , s);
        if(i == 0)
        {
            hr = atoi(s.substr(1 , 2).c_str());
            mn = atoi(s.substr(4 , 2).c_str());
            am = s[7]=='a';
            res ++;
            td ++;
            continue;
        }
        if(hr == 12)
            hr = 0;
        int h = atoi(s.substr(1 , 2).c_str());
        int m = atoi(s.substr(4 , 2).c_str());
        bool a = s[7] == 'a';
        if(am == a && (hr < h || (hr == h && mn <= m)))
            td ++;
        else if(am && !a)
        {
            td ++;
        }
        else
        {
            td = 0;
            res ++;
        }
        hr = h;
        mn = m;
        am = a;
        if(td > 10)
        {
            td = 0;
            res ++;
        }
    }
    cout << res << endl;
    return 0;
}


/*
Author : OmarEl-Mohandes
PROG   : D
LANG   : C++
*/
#include <map>
#include <string>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <memory.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz size()
#define rep(i,m) for(int i=0;i<m;i++)
#define REP(i,k,m) for(int i=k;i<m;i++)
#define mem(a,b) memset(a,b,sizeof(a))
#define mp make_pair
typedef stringstream ss;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef unsigned long long ll;
#define oo ((int)1e9)
int main()
{
    //freopen("test.in" , "rt" , stdin);
    //freopen("D.out" , "wt" , stdout);
    int n;
    cin >> n;
    string s;
    getline(cin , s);
    int mn , hr , td = 0 , res = 0;
    bool am;
    rep(i , n)
    {
        getline(cin , s);
        if(i == 0)
        {
            hr = atoi(s.substr(1 , 2).c_str());
            mn = atoi(s.substr(4 , 2).c_str());
            am = s[7]=='a';
            res ++;
            td ++;
            continue;
        }
        if(hr == 12)
            hr = 0;
        int h = atoi(s.substr(1 , 2).c_str());
        int m = atoi(s.substr(4 , 2).c_str());
        bool a = s[7] == 'a';
        if(h == 12)
            h = 0;
        if(am == a && (hr < h || (hr == h && mn <= m)))
            td ++;
        else if(am && !a)
        {
            td ++;
        }
        else
        {
            td = 0;
            res ++;
        }
        hr = h;
        mn = m;
        am = a;
        if(td > 10)
        {
            td = 0;
            res ++;
        }
    }
    cout << res << endl;
    return 0;
}


/*
Author : OmarEl-Mohandes
PROG   : D
LANG   : C++
*/
#include <map>
#include <string>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <memory.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz size()
#define rep(i,m) for(int i=0;i<m;i++)
#define REP(i,k,m) for(int i=k;i<m;i++)
#define mem(a,b) memset(a,b,sizeof(a))
#define mp make_pair
typedef stringstream ss;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef unsigned long long ll;
#define oo ((int)1e9)
int main()
{
	//freopen("test.in" , "rt" , stdin);
	//freopen("D.out" , "wt" , stdout);
	int n;
	cin >> n;
	string s;
	getline(cin , s);
	int mn , hr , td = 0 , res = 0;
	bool am;
	vector<pair<bool , int> > al;
	rep(i , n)
	{
		getline(cin , s);
		hr = atoi(s.substr(1 , 2).c_str());
		mn = atoi(s.substr(4 , 2).c_str());
		am = s[7]=='a';
		hr+=(am?0:11);
		al.pb(mp(am , hr * 60 + mn));
	}
	int i = 0;
	while(i < n)
	{
		mn = al[i].second;
		td = 0;
		while(i < n)
		{
			if(mn == al[i].second && td == 10)
				break;
			else if(mn > al[i].second)
				break;

			if(mn == al[i].second)
				td ++;
			else
				td = 1;
			mn = al[i].second;
			i ++;
		}
		res ++;
	}
	cout << res << endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>

const int mod = 1e9+7;
const int N = 100010;
const int inf = 0x3f3f3f3f;
const double eps=1e-8;

using namespace std;

typedef long long ll;

char s[N];

int main(){
	int pre = -1, cnt = 1;
	int ca;
	for(scanf("%d\n", &ca); ca--; ){
		gets(s);
		int h, m;
		char c;
		sscanf(s, "[%d:%d %c.m.]", &h, &m, &c);
		if(c == 'p') h += 12;
		if(c == 'a' && h == 12) h = 0;
		if(pre <= h * 10000 + m) pre = h * 10000 + m;
		else pre = h * 10000 + m, cnt++;
	}
	cout << cnt << endl;
	return 0;
}


#include <iostream>
#include <string>
using namespace std;
int a,b,res,t,t1,j,x,i,n,k;
string s;

int main()
{
    //freopen("input.txt","r",stdin);
    cin>>n;
	getline(cin,s);
	x=1000000000;
	res=0;
	k=0;
	for(i=0;i<n;i++)
	{
		getline(cin,s);

		t=0;
		for(j=1;j<=2;j++)t=10*t+int(s[j])-48;

		t=60*t;
		t1=0;
		for(j=4;j<=5;j++)t1=10*t1+int(s[j])-48;
		t=t+t1;

		if(s[7]=='a' && t/60==12)t=t1;else
			if(s[7]=='p' && t/60==12)t=t;else
				if(s[7]=='p')t=12*60+t;

		if(t==x)k++;else k=1;

		if(k>10){res++;k=1;}else
		if(t<x)res++;
		x=t;

	}
	cout<<res<<endl;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>

const int mod = 1e9+7;
const int N = 100010;
const int inf = 0x3f3f3f3f;
const double eps=1e-8;

using namespace std;

typedef long long ll;

char s[N];

int main(){
	int pre = -1, cnt = 1;
	int ca;
	for(scanf("%d\n", &ca); ca--; ){
		gets(s);
		int h, m;
		char c;
		sscanf(s, "[%d:%d %c.m.]", &h, &m, &c);
		if(c == 'p') h += 12;
		if(pre <= h * 10000 + m) pre = h * 10000 + m;
		else pre = h * 10000 + m, cnt++;
	}
	cout << cnt << endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>

const int mod = 1e9+7;
const int N = 100010;
const int inf = 0x3f3f3f3f;
const double eps=1e-8;

using namespace std;

typedef long long ll;

char s[N];

int main(){
	int pre = -1, cnt = 0;
	int ca, t = 0;
	for(scanf("%d\n", &ca); ca--; ){
		gets(s);
		int h, m;
		char c;
		sscanf(s, "[%d:%d %c.m.]", &h, &m, &c);
		if(c == 'a' && h == 12) h = 0;
		else if(c == 'p') h += 12;
		if(pre == h * 10000 + m) t++;
		else t = 0;
		if(t > 9) t = 0, cnt++;
		if(h * 10000 + m < pre) cnt++;
		pre = h * 10000 + m;
	}
	cout << cnt + 1 << endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>

const int mod = 1e9+7;
const int N = 100010;
const int inf = 0x3f3f3f3f;
const double eps=1e-8;

using namespace std;

typedef long long ll;

char s[N];

int main(){
	int pre = -1, cnt = 0;
	int ca, t = 0;
	for(scanf("%d\n", &ca); ca--; ){
		gets(s);
		int h, m;
		char c;
		sscanf(s, "[%d:%d %c.m.]", &h, &m, &c);
		if(c == 'p') h += 12;
		if(c == 'a' && h == 12) h = 0;
		if(pre == h * 10000 + m) t++;
		else t = 0;
		if(t > 9) t = 0, cnt++;
		if(h * 10000 + m < pre) cnt++;
		pre = h * 10000 + m;
	}
	cout << cnt + 1 << endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>

const int mod = 1e9+7;
const int N = 100010;
const int inf = 0x3f3f3f3f;
const double eps=1e-8;

using namespace std;

typedef long long ll;

char s[N];

int main(){
	int pre = -1, cnt = 1;
	int ca, t = 0;
	for(scanf("%d\n", &ca); ca--; ){
		gets(s);
		int h, m;
		char c;
		sscanf(s, "[%d:%d %c.m.]", &h, &m, &c);
		if(c == 'p') h += 12;
		if(c == 'a' && h == 12) h = 0;
		if(pre < h * 10000 + m) pre = h * 10000 + m, t = 0;
		else if(pre == h * 10000 + m) pre = h * 10000 + m, t++;
		else pre = h * 10000 + m, cnt++, t = 0;
		if(t > 9) t = 0, cnt++;
	}
	cout << cnt << endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>

const int mod = 1e9+7;
const int N = 100010;
const int inf = 0x3f3f3f3f;
const double eps=1e-8;

using namespace std;

typedef long long ll;

char s[N];

int main(){
	int pre = -1, cnt = 1;
	int ca, t = 0;
	for(scanf("%d\n", &ca); ca--; ){
		gets(s);
		int h, m;
		char c;
		sscanf(s, "[%d:%d %c.m.]", &h, &m, &c);
		if(c == 'p') h += 12;
		if(c == 'a' && h == 12) h = 0;
		if(pre == h * 10000 + m) t++;
		else t = 0;
		if(t > 9) t = 0, cnt++;
		if(h * 10000 + m < pre) cnt++;
		pre = h * 10000 + m;
	}
	cout << cnt << endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>

const int mod = 1e9+7;
const int N = 100010;
const int inf = 0x3f3f3f3f;
const double eps=1e-8;

using namespace std;

typedef long long ll;

char s[N];

int main(){
	int pre = -1, cnt = 1;
	int ca, t = 0;
	for(scanf("%d\n", &ca); ca--; ){
		gets(s);
		int h, m;
		char c;
		sscanf(s, "[%d:%d %c.m.]", &h, &m, &c);
		if(c == 'p') h += 12;
		if(c == 'a' && h == 12) h = 0;
		if(pre == h * 10000 + m) t++;
		else t = 0;
		if(t > 9) t = 0, cnt++;
		if(h * 10000 + m < pre) cnt++;
		pre = h * 10000 + m
	}
	cout << cnt << endl;
	return 0;
}


#include <iostream>
#include <math.h>
#include <stdio.h>
#include <vector>
#include <string>

using namespace std;
 vector <int> a;

 bool check(int i){
	 for (int k=i; k>i-10; k--) if (a[k]!=a[k-1]) return 0;
	 return 1;
 };

int main () {
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);

	int n,sum=1;
	cin>>n;

	a.push_back(0);
	string s;

	getline(cin,s);
	for (int i=1; i<=n; i++){
		getline(cin,s);
		a.push_back(((s[1]-'0')*10+s[2]-'0')*60+(s[4]-'0')*10+s[5]-'0');
		if (s.substr(7,4)=="p.m.") a[i]+=720;
		if (a[i]<a[i-1]) sum++; else
			if (i-10>0 && check(i)) sum++;
	};

	cout<<sum;

 return 0;
}