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

#define LL long long
#define PII pair<int, int >
#define PLL pair<long long, long long >

const int pp = (1e9) + 7;

int N, sgn, ans1, ans2, ans;
int A[200010], H[200010], Hrev[200010];

LL C(int N, int M){
	LL res = H[N];
	res = res * Hrev[N] % pp;
	res = res * Hrev[M] % pp;
	return res;
}

LL quick(int x, int y){
	LL s = 1, t = x;
	for (; y; y >>= 1){
		if (y & 1) s = s * t % pp;
		t = t * t % pp;
	}
	return s;
}

int work(int head){
	int M = N / 2 - 1;
	int res = 0;
	for (int i = 0; i <= M; i++){
		res += C(M, i) * A[head + 2 * i] % pp;
		res %= pp;
	}
	return res;
}

int main(){
	scanf("%d", &N);
	for (int i = 1; i <= N; i++)
		scanf("%d", &A[i]);
	if (N == 1){
		printf("%d\n", A[1]);
		return 0;
	}
	H[0] = 1;
	for (int i = 1; i <= N; i++)
		H[i] = (LL)H[i - 1] * i % pp;
	Hrev[N] = quick(H[N], pp - 2);
	for (int i = N - 1; i >= 0; i--)
		Hrev[i] = (LL)Hrev[i + 1] * (i + 1) % pp;
	if (N & 1){
		sgn = 1;
		for (int i = 1; i < N; i++){
			A[i] = (A[i] + sgn * A[i + 1]) % pp;
			if (A[i] < 0) A[i] += pp;
			sgn = -sgn;
		}
		N--;
	}
	ans1 = work(1);
	ans2 = work(2);
	N /= 2;
	if (N & 1) sgn = 1;
	else sgn = -1;
	ans = (ans1 + sgn * ans2) % pp;
	if (ans < 0) ans += pp;
	cout << ans << endl;
}


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

#define LL long long
#define PII pair<int, int >
#define PLL pair<long long, long long >

const int pp = (1e9) + 7;

int N, sgn, ans1, ans2, ans;
int A[200010], H[200010], Hrev[200010];

LL C(int N, int M){
	LL res = H[N];
	res = res * Hrev[N] % pp;
	res = res * Hrev[M] % pp;
	return res;
}

LL quick(int x, int y){
	LL s = 1, t = x;
	for (; y; y >>= 1){
		if (y & 1) s = s * t % pp;
		t = t * t % pp;
	}
	return s;
}

int work(int head){
	int M = N / 2 - 1;
	int res = 0;
	for (int i = 0; i <= M; i++){
		res += C(M, i) * A[head + 2 * i] % pp;
		res %= pp;
	}
	return res;
}

int main(){
	scanf("%d", &N);
	for (int i = 1; i <= N; i++)
		scanf("%d", &A[i]);
	H[0] = 1;
	for (int i = 1; i <= N; i++)
		H[i] = (LL)H[i - 1] * i % pp;
	Hrev[N] = quick(H[N], pp - 2);
	for (int i = N - 1; i >= 0; i--)
		Hrev[i] = (LL)Hrev[i + 1] * (i + 1) % pp;
	if (N & 1){
		sgn = 1;
		for (int i = 1; i < N; i++){
			A[i] = (A[i] + sgn * A[i + 1]) % pp;
			if (A[i] < 0) A[i] += pp;
			sgn = -sgn;
		}
		N--;
	}
	ans1 = work(1);
	ans2 = work(2);
	N /= 2;
	if (N & 1) sgn = 1;
	else sgn = -1;
	ans = (ans1 + sgn * ans2) % pp;
	if (ans < 0) ans += pp;
	cout << ans << endl;
}


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

#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define fi first
#define se second
#define re register
template <class Q> Q _sqr(Q x){return x * x;}
template <class Q> void gi(Q &x){
  char ch = getchar(); x = 0; int s = 1;
  while (ch < '0' || ch > '9'){if (ch == '-') s = -1; ch = getchar();}
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - 48, ch = getchar();
  if (s == -1) x = -x;
}
template <class Q> void pi(Q x){
  if (x < 0){putchar('-'); pi(-x);}
  else {if (x > 9) pi(x / 10); putchar(x % 10 + 48);}
}

typedef long long int ll;
typedef long double LF;
typedef double lf;

const int sz = 400200;
const int huge = 1000000000;
const ll hugell = 1ll << 61;
const lf hugelf = 1e50;
const lf eps = 1e-10;
const int ljz = 1000000007;
void MOD(int &x){if (x >= ljz) x -= ljz; if (x < 0) x += ljz;}
int Tm(int a, int b){ll x = a, y = b; return (x * y) % ljz;}
int fpm(int x, int y){int p = 1, s = x; for (; y; y >>= 1){if (y & 1) p = Tm(p, s); s = Tm(s, s);} return p;}
int Tm(int a, int b, int c){return Tm(Tm(a, b), c);}
int Tm(int a, int b, int c, int d){return Tm(Tm(a, b, c), d);}
int Tm(int a, int b, int c, int d, int e){return Tm(Tm(a, b, c, d), e);}
int Tm(int a, int b, int c, int d, int e, int f){return Tm(Tm(a, b, c, d, e), f);}

#define y0 y_0
#define y1 y_1
#define x0 x_0
#define x1 x_1
#define next nxt
#define tm tmd

#ifdef WIN32
#define f64 "%I64d"
#define ran (rand() * 32768 + rand())
#define rand_max (RAND_MAX * 32768)
#else
#define f64 "%lld"
#define ran rand()
#define rand_max RAND_MAX
#endif

int n, i, a[233333], jc[233333], jcn[233333];
int C(int n, int k) {return Tm(jc[n], Tm(jcn[k], jcn[n - k]));}
int main(){
  int ans = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = jc[0] = 1; i <= n; i++) jc[i] = Tm(jc[i - 1], i);
  for (i = n, jcn[n] = fpm(jc[n], ljz - 2); i; i--) jcn[i - 1] = Tm(jcn[i], i);

  if (n % 4 == 0) {
    int N = n / 2 - 1, s = 0;
    for (int i = 1; i <= n; i += 2) MOD(ans += Tm(a[i] - a[i + 1], C(N, s++)));
  } else if (n % 4 == 1) {
    int N = n / 2, s = 0;
    for (int i = 1; i <= n; i += 2) MOD(ans += Tm(a[i], C(N, s++)));
  } else if (n % 4 == 2) {
    int N = n / 2 - 1, s = 0;
    for (int i = 1; i <= n; i += 2) MOD(ans += Tm(a[i] + a[i + 1], C(N, s++)));
  } else {
    int N = n / 2 - 1, s = 0;
    for (int i = 1; i + 2 <= n; i += 2) MOD(ans += Tm(a[i] + a[i + 1], C(N, s++)));
    s = 0;
    for (int i = 2; i <= n; i += 2) MOD(ans += Tm(a[i] - a[i + 1], C(N, s++)));
  }
  printf("%d", ans); return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 2e5 + 5;
const int AwD = 1e9 + 7;
int n;
LL a[maxn];
LL b[maxn],fac[maxn];

LL AwD_pow(LL n,LL m) {
    LL ret = 1;
    while(m) {
        if(m&1) {
            ret = ret*n % AwD;
        }
        n = n*n % AwD;
        m >>= 1;
    }
    return ret;
}

int main() {
    while(~scanf(" % d",&n)) {
        for(int i = 0; i < n; i ++) {
            scanf(" % lld",&a[i]);
            b[i] = a[i];
        }
        if(n == 1) {
            printf(" % lld\n",a[0]);
            continue;
        }
        if(n&1) {
            n --;
            int op = 0;
            for(int i = 0; i < n; i ++) {
                if(!op) {
                    a[i] = (b[i] + b[i + 1]) % AwD;
                }
                else {
                    a[i] = (b[i] - b[i + 1] + AwD) % AwD;
                }
                op ^= 1;
            }
        }
        n = n / 2 - 1;
        fac[0] = 1;
        for(int i = 1; i <= n; i ++) {
            fac[i] = fac[i - 1]*(LL)i % AwD;
        }
        LL ans1 = 0,ans2 = 0;
        for(int i = 0; i <= n; i ++) {
            LL temp  =  fac[n]*AwD_pow(fac[i]*fac[n - i] % AwD, AwD - 2) % AwD;
            ans1  =  (ans1 + temp*a[i*2] % AwD) % AwD;
            ans2  =  (ans2 + temp*a[i*2 + 1] % AwD) % AwD;
        }
        LL ans;
        if(n&1) {
            ans = (ans1 - ans2 + AwD) % AwD;
        }
        else {
            ans = (ans1 + ans2) % AwD;
        }
        printf(" % lld\n",ans);
    }
    return 0;
}


#include < bits / stdc ++.h>
using namespace std;
typedef long long LL;
const int maxn = 2e5 + 5;
const int AwD = 1e9 + 7;
int n;
LL a[maxn];
LL b[maxn],fac[maxn];

LL AwD_pow(LL n,LL m) {
    LL ret = 1;
    while(m) {
        if(m&1) {
            ret = ret*n % AwD;
        }
        n = n*n % AwD;
        m>> = 1;
    }
    return ret;
}

int main() {
    while(~scanf(" % d",&n)) {
        for(int i = 0; i < n; i ++) {
            scanf(" % lld",&a[i]);
            b[i] = a[i];
        }
        if(n == 1) {
            printf(" % lld\n",a[0]);
            continue;
        }
        if(n&1) {
            n --;
            int op = 0;
            for(int i = 0; i < n; i ++) {
                if(!op) {
                    a[i] = (b[i] + b[i + 1]) % AwD;
                }
                else {
                    a[i] = (b[i] - b[i + 1] + AwD) % AwD;
                }
                op ^= 1;
            }
        }
        n = n / 2 - 1;
        fac[0] = 1;
        for(int i = 1; i <= n; i ++) {
            fac[i] = fac[i - 1]*(LL)i % AwD;
        }
        LL ans1 = 0,ans2 = 0;
        for(int i = 0; i <= n; i ++) {
            LL temp  =  fac[n]*AwD_pow(fac[i]*fac[n - i] % AwD, AwD - 2) % AwD;
            ans1  =  (ans1 + temp*a[i*2] % AwD) % AwD;
            ans2  =  (ans2 + temp*a[i*2 + 1] % AwD) % AwD;
        }
        LL ans;
        if(n&1) {
            ans = (ans1 - ans2 + AwD) % AwD;
        }
        else {
            ans = (ans1 + ans2) % AwD;
        }
        printf(" % lld\n",ans);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 2e5 + 5;
const int AwD = 1e9 + 7;
int n;
LL a[maxn];
LL b[maxn],fac[maxn];

LL AwD_pow(LL n,LL m) {
    LL ret = 1;
    while(m) {
        if(m&1) {
            ret = ret*n % AwD;
        }
        n = n*n % AwD;
        m >>= 1;
    }
    return ret;
}

int main() {
    while(~scanf("%d",&n)) {
        for(int i = 0; i < n; i ++) {
            scanf("%lld", &a[i]);
            b[i] = a[i];
        }
        if(n == 1) {
            printf("%lld\n",a[0]);
            continue;
        }
        if(n&1) {
            n --;
            int op = 0;
            for(int i = 0; i < n; i ++) {
                if(!op) {
                    a[i] = (b[i] + b[i + 1]) % AwD;
                }
                else {
                    a[i] = (b[i] - b[i + 1] + AwD) % AwD;
                }
                op ^= 1;
            }
        }
        n = n / 2 - 1;
        fac[0] = 1;
        for(int i = 1; i <= n; i ++) {
            fac[i] = fac[i - 1]*(LL)i % AwD;
        }
        LL ans1 = 0,ans2 = 0;
        for(int i = 0; i <= n; i ++) {
            LL temp  =  fac[n]*AwD_pow(fac[i]*fac[n - i] % AwD, AwD - 2) % AwD;
            ans1  =  (ans1 + temp*a[i*2] % AwD) % AwD;
            ans2  =  (ans2 + temp*a[i*2 + 1] % AwD) % AwD;
        }
        LL ans;
        if(n & 1) {
            ans = (ans1 - ans2 + AwD) % AwD;
        }
        else {
            ans = (ans1 + ans2) % AwD;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 2e5 + 5;
const int AwD = 1e9 + 7;
int n;
LL a[maxn];
LL b[maxn],fac[maxn];

LL AwD_pow(LL n,LL m) {
    LL ret = 1;
    while(m) {
        if(m&1) {
            ret = ret*n % AwD;
        }
        n = n*n % AwD;
        m>> = 1;
    }
    return ret;
}

int main() {
    while(~scanf(" % d",&n)) {
        for(int i = 0; i < n; i ++) {
            scanf(" % lld",&a[i]);
            b[i] = a[i];
        }
        if(n == 1) {
            printf(" % lld\n",a[0]);
            continue;
        }
        if(n&1) {
            n --;
            int op = 0;
            for(int i = 0; i < n; i ++) {
                if(!op) {
                    a[i] = (b[i] + b[i + 1]) % AwD;
                }
                else {
                    a[i] = (b[i] - b[i + 1] + AwD) % AwD;
                }
                op ^= 1;
            }
        }
        n = n / 2 - 1;
        fac[0] = 1;
        for(int i = 1; i <= n; i ++) {
            fac[i] = fac[i - 1]*(LL)i % AwD;
        }
        LL ans1 = 0,ans2 = 0;
        for(int i = 0; i <= n; i ++) {
            LL temp  =  fac[n]*AwD_pow(fac[i]*fac[n - i] % AwD, AwD - 2) % AwD;
            ans1  =  (ans1 + temp*a[i*2] % AwD) % AwD;
            ans2  =  (ans2 + temp*a[i*2 + 1] % AwD) % AwD;
        }
        LL ans;
        if(n&1) {
            ans = (ans1 - ans2 + AwD) % AwD;
        }
        else {
            ans = (ans1 + ans2) % AwD;
        }
        printf(" % lld\n",ans);
    }
    return 0;
}


#include <vector>
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <stdio.h>
using namespace std;

long long v[200010];
long long f[200010];
long long mod = 1000000007;

long long fpow(long long x, int y) {

	if (y == 0)
		return 1;

	long long res = 1;
	while (y > 0) {

		if (y & 1) {
			res = (res*x)%mod;
			y--;
		}
		else {
			x = (x*x)%mod;
			y /= 2;
		}

	}

	return res;
}

long long coef(int x, int y) {

	long long num = f[x];
	long long den = (f[y]*f[x-y])%mod;

	return (num*fpow(den, mod-2))%mod;
}

int main() {

	int n;
	cin>>n;

	f[0] = 1;
	for (int i=1; i<=n; i++) f[i] = (f[i-1]*i)%mod;

	int m = n/2;

	for (int i=0; i<2*m; i+=2) {

		v[i] = coef(m-1, i/2);
		if (m%2==0)
			v[i+1] = -v[i];
		else
			v[i+1] = v[i];
	}

	/*
	for (int i=0; i<2*m; i++) {
		cout<<v[i]<<" ";
	}

	cout<<endl;
	*/

	if (n != 2*m) {

		int p = 1;
		for (int i=n-1; i>=0; i--) {

			v[i+1] = p*v[i] + v[i+1];
			p = -1*p;

		}

	}

	/*
	for (int i=0; i<n; i++) {
		cout<<v[i]<<" ";
	}
	*/

	if (n == 1)
		v[0] = 1;

	long long res = 0;
	for (int i=0; i<n; i++) {
		int x;
		scanf("%d", &x);

		res = (res + (x*v[i])%mod)%mod;
		res = (res + mod)%mod;
	}

	cout<<res<<endl;

    return 0;

}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int N = 201000,mod = 1e9+7;
int add(int x,int y){
	x += y;while (x >= mod) x -= mod;return x;
}
int power(int x,int y){
	int ans = 1;
	while (y){
		if(y&1) ans = (ll)ans*x%mod;
		x = (ll)x*x%mod;
		y >>= 1;
	}
	return ans;
}
int n,a[N],ans,fact[N],finv[N];
int C(int x,int y){
	return (ll)fact[x]*finv[y]%mod*finv[x-y]%mod;
}
int main(){
	scanf("%d",&n);
	fact[0] = 1;for (int i = 1;i <= n;i++) fact[i] = (ll)fact[i-1]*i%mod;
	finv[n] = power(fact[n],mod-2);
	for (int i = n;i >= 1;i--) finv[i-1] = (ll)finv[i]*i%mod;
	for (int i = 1;i <= n;i++) scanf("%d",&a[i]);
	if(n == 1) printf("%d\n",a[1]);
	else {
		if(n&1){
			for (int i = 1;i < n;i++)
				a[i] = i&1 ? add(a[i],a[i+1]) : add(a[i],mod-a[i+1]);
			n--;
		}
		if (n%4 == 0){
			int w = n/2-1;
			for (int i = 0;i <= w;i++)
				ans = add(ans,(ll)a[i*2+1]*C(w,i)%mod);
			for (int i = 0;i <= w;i++)
				ans = add(ans,mod-(ll)a[i*2+2]*C(w,i)%mod);
		}
		else{
			int w = n/2-1;
			for (int i = 0;i <= w;i++)
				ans = add(ans,(ll)a[i*2+1]*C(w,i)%mod);
			for (int i = 0;i <= w;i++)
				ans = add(ans,(ll)a[i*2+2]*C(w,i)%mod);
		}
		printf("%d\n",ans);
	}
	return 0;
}


#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
ll a[200001];
int data[201][201][201];
ll fact[200001];

ll extgcd(ll a,ll b,ll& x,ll& y){
	ll d=a;
	if(b!=0){
		d=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}else{
		x=1;
		y=0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
	ll x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}

ll mod_fact(ll n,ll p,ll& e){
	e=0;
	if(n==0)return 1;
	ll res=mod_fact(n/p,p,e);
	e+=n/p;
	if(n/p%2!=0)return res*(p-fact[n%p])%p;
	return res*fact[n%p]%p;
}

ll mod_comb(ll n,ll k,ll p){
	if(n<0 || k<0 || n<k)return 0;
	ll e1,e2,e3;
	ll a1=mod_fact(n,p,e1),a2=mod_fact(k,p,e2),a3=mod_fact(n-k,p,e3);
	if(e1>e2+e3)return 0;
	return a1*mod_inverse(a2*a3%p,p)%p;
}

int main(void){
	scanf("%d",&n);
	fact[0]=1;
	fact[1]=1;
	for(int i=2;i<=n;i++){
		fact[i]=(ll)fact[i-1]*i%MOD;
	}
	for(int i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	ll res=0;
	if(n<=4){
		if(n==1){
			printf("%lld\n",a[0]);
		}
		if(n==2){
			printf("%lld\n",(a[0]+a[1])%MOD);
		}
		if(n==3){
			printf("%lld\n",(a[0]+2LL*a[1]-a[2]+MOD)%MOD);
		}
		if(n==4){
			printf("%lld\n",(a[0]-a[1]+a[2]-a[3]+MOD+MOD)%MOD);
		}
	}else{
		if(n%4==2){
			int v=(n-2)/2;
			for(int i=0;i<n;i++){
				ll val=mod_comb(v,i/2,MOD)*a[i]%MOD;
				res=(res+val)%MOD;
			}
		}
		if(n%4==0){
			int v=(n-2)/2;
			for(int i=0;i<n;i++){
				ll val=mod_comb(v,i/2,MOD)*a[i]%MOD;
				if(i%2==0)res=(res+val)%MOD;
				else{
					res=(res-val+MOD)%MOD;
				}
			}
		}
		if(n%4==3){
			int v=(n-3)/2;
			for(int i=0;i<2;i++){
				for(int j=0;j<n-1;j++){
					ll val=mod_comb(v,j/2,MOD)*a[i+j]%MOD;
					if(i==0){
						res=(res+val)%MOD;
					}else{
						if(j%2==0){
							res=(res+val)%MOD;
						}else{
							res=(res-val+MOD)%MOD;
						}
					}
				}
			}
		}
		if(n%4==1){
			int v=(n-1)/2;
			for(int i=0;i<n;i++){
				if(i%2==1)continue;
				ll val=mod_comb(v,i/2,MOD)*a[i]%MOD;
				res=(res+val)%MOD;
			}
		}
		printf("%lld\n",res);
	}
	/*
	for(int i=1;i<=n;i++){
		for(int j=0;j<=n;j++){
			printf("%lld ",mod_comb(i,j,MOD));
		}
		printf("\n");
	}
	for(int i=0;i<n;i++){
		data[0][i][i]=1;
	}
	int flag=1;
	for(int i=0;i<n-1;i++){
		for(int j=0;j<n-i-1;j++){
			for(int k=0;k<n;k++){
				if(flag==1){
					data[i+1][j][k]=data[i][j][k]+data[i][j+1][k];
				}else{
					data[i+1][j][k]=data[i][j][k]-data[i][j+1][k];
				}
			}
			flag=1-flag;
		}
	}
	for(int i=0;i<n;i++){
		printf("%d ",data[n-1][0][i]);
	}
	printf("\n");
	for(int i=0;i<n;i++){
		printf("%d ",data[n-2][0][i]);
	}
	printf("\n");
	for(int i=0;i<n;i++){
		printf("%d ",data[n-2][1][i]);
	}
	printf("\n");
	*/
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cstdlib>

using namespace std;
const int MOD=1e9+7;
int n,m,a[7][233333];
int fact[233333];
inline int inv(int x)
{
	int bit=1<<30,y=MOD-2;
	long long ret=1;
	while(bit)
	{
		ret*=ret,ret%=MOD;
		if(bit&y)ret*=x,ret%=MOD;
		bit>>=1;
	}
	return ret;
}
inline int C(int n,int m)
{
	return 1ll*fact[n]*inv(fact[m])%MOD*inv(fact[n-m])%MOD;
}
int main()
{
	fact[0]=1;
	for(int i=1;i<=200000;i++)fact[i]=1ll*fact[i-1]*i%MOD;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[1][i]);
	}
	if(n==1)return printf("%d\n",a[1][1]),0;
	int l=2,t=n-1,cur=1;
	for(;;l++,t--)
	{
		for(int j=1;j<=t;j++)
		{
			if(cur)a[l][j]=a[l-1][j]+a[l-1][j+1];
			else a[l][j]=a[l-1][j]-a[l-1][j+1];
			if(a[l][j]>=MOD)a[l][j]-=MOD;
			if(a[l][j]<0)a[l][j]+=MOD;
			cur^=1;
		}
		if(t%4==1)break;
	}
	//for(int i=1;i<=l;i++){for(int j=1;j<=n+1-i;j++)cout<<a[i][j]<<' ';cout<<endl;}
	long long ans=0;
	for(int i=1;i<=t;i+=2)
	{
		//cout<<C(t/2,i/2)<<' '<<a[l][i]<<' '<<1ll*C(t/2,i/2)*a[l][i]<<endl;
		ans+=1ll*C(t/2,i/2)*a[l][i]%MOD;
		ans%=MOD;
	}
	if(ans<0)ans+=MOD;
	printf("%lld\n",ans);
	return 0;
}


#include<bits/stdc++.h>

#define x first

#define y second

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(x) ((x)*(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<class T>inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template<class T>inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T>inline void printsp(T x) {print(x); putchar(' ');}

template<class T>inline void println(T x) {print(x); putchar('\n');}

template<class T, class U>inline void print(T x, U y) {printsp(x); println(y);}

template<class T, class U, class V>inline void print(T x, U y, V z) {printsp(x); printsp(y); println(z);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define nn 300010

int ch[nn],re[nn],a[nn];

int C(int n,int m){

	return ((INT)ch[n]*re[m]%mod)*(INT)re[n-m]%mod;

}

void pre(){

	ch[0]=1;

	for(int i=1; i<nn; i++) ch[i]=(INT)ch[i-1]*i%mod;

	re[nn-1]=power(ch[nn-1],mod-2,mod);

	for(int i=nn-1; i>0; i--) re[i-1]=(INT)re[i]*i%mod;

	return;

}

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	pre();

	int n;gn(n);

	for(int i=1; i<=n; i++) gn(a[i]);

	if(n==1){

		printf("%d\n",a[1]);

		return 0;

	}

	if(n==2){

		printf("%d\n",((a[1]+a[2])%mod+mod)%mod);

		return 0;

	}

	if(n&1){

		for(int i=1; i<n; i++) {

			if(i&1) a[i]=((a[i]+a[i+1])%mod+mod)%mod;

			else a[i]=((a[i]-a[i+1])%mod+mod)%mod;

		}

		n--;

	}

	if(n==2){

		printf("%d\n",(a[1]+a[2])%mod);

		return 0;

	}

	INT ans1=0,ans2=0;

	int m=n/2;

	for(int i=1; i<=n; i++){

		if(i&1){

			ans1=(ans1+(INT)C(m-1,i/2)*a[i]%mod)%mod;

		}

		else{

			ans2=(ans2+(INT)C(m-1,i/2-1)*a[i]%mod)%mod;

		}

	}

	if(m&1==1) printf("%I64d\n",(ans1+ans2)%mod);

	else printf("%I64d\n",((ans1-ans2)%mod+mod)%mod);

	return 0;

}


#include<bits/stdc++.h>

#define x first

#define y second

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(x) ((x)*(x))

#define bit(x, y) (((x)>>(y))&1)

#define bctz(x) (__builtin_ctz(x))

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzl(x))

#define bctzl(x) (__builtin_ctzl(x))

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

template <class T> inline void gn(T &x) {char c, sg=0; while(c=getchar(), (c>'9' || c<'0') && c!='-'); for((c=='-' ? sg=1, c=getchar() : 0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0'; if(sg) x=-x;}

template <class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}

template <class T1, class T2, class T3> inline void gn(T1 &x1, T2 &x2, T3 &x3) {gn(x1, x2), gn(x3);}

template <class T1, class T2, class T3, class T4> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4) {gn(x1, x2, x3), gn(x4);}

template <class T1, class T2, class T3, class T4, class T5> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5) {gn(x1, x2, x3, x4), gn(x5);}

template <class T> inline void print(T x) {if(x<0) {putchar('-'); return print(-x);} if(x<10) {putchar('0'+x); return ;} print(x/10); putchar(x%10+'0');}

template <class T> inline void println(T x) {print(x); putchar('\n');}

template <class T> inline void printsp(T x) {print(x); putchar(' ');}

template <class T1, class T2> inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}

template <class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}

template <class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}

template <class T1, class T2, class T3, class T4, class T5> inline void print(T1 x1, T2 x2, T3 x3, T4 x4, T5 x5) {printsp(x1), printsp(x2), printsp(x3), printsp(x4), println(x5);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200010

int a[NN], f[NN], inv[NN];

void init() {

	f[0]=1;

	for(int i=1; i<NN; i++) {

		f[i]=(INT)i*f[i-1]%mod;

	}

	inv[NN-1]=power(f[NN-1], mod-2, mod);

	for(int i=NN-1; i--; ) {

		inv[i]=(INT)inv[i+1]*(i+1)%mod;

	}

}

int c(int n, int k) {

	return (INT)f[n]*inv[k]%mod*inv[n-k]%mod;

}

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	init();

	int n;

	gn(n);

	for(int i=1; i<=n; i++) gn(a[i]);

	if(n==1) {

		println(a[1]);

		return 0;

	}

	if(n&1) {

		for(int i=1; i<n; i++) {

			if(i&1) a[i]=(a[i]+a[i+1])%mod;

			else a[i]=(a[i]-a[i+1]+mod)%mod;

		}

		n--;

	}

	int A=0, B=0, N=n-1>>1;

	for(int i=1; i<=n; i++) {

		if(i&1) A=(A+(INT)c(N, i>>1)*a[i])%mod;

		else B=(B+(INT)c(N, i-1>>1)*a[i])%mod;

	}

	if(n%4) {

		A+=B;

		if(A>=mod) A-=mod;

	}

	else {

		A-=B;

		if(A<0) A+=mod;

	}

	println(A);

}


#include <bits/stdc++.h>

using namespace std;

int n, m, k;
long long x[200005], fac[200005], inv[200005], ans, ta;
const long long MOD = 1000000007;

long long po(long long b, long long p) {
	if (!p)
		return 1;
	if (p & 1)
		return po(b, p - 1) * b % MOD;
	long long t = po(b, p >> 1);
	return t * t % MOD;
}

int main() {
	scanf("%d", &n);
	m = n;
	while (m % 4 != 1)
		m--;
	fac[0] = inv[0] = 1;
	k = (m - 1) / 2;
	for (int i = 1; i <= k; i++)
		inv[i] = po(fac[i] = fac[i - 1] * i % MOD, MOD - 2);
	for (int i = 1; i <= m; i++)
		if (i % 2)
			x[i] = fac[k] * inv[(i - 1) / 2] % MOD * inv[k - (i - 1) / 2] % MOD;
	if (m != n) {
		m++;
		for (int i = m; i; i--)
			x[i] = (x[i - 1] + x[i]) % MOD;
	}
	if (m != n) {
		m++;
		for (int i = m; i; i--)
			if (i % 2)
				x[i] = (x[i] - x[i - 1] + MOD) % MOD;
			else
				x[i] = (-x[i] - x[i - 1] + MOD + MOD) % MOD;
	}
	if (m != n) {
		m++;
		for (int i = m; i; i--)
			if (i % 2)
				x[i] = (x[i] - x[i - 1] + MOD) % MOD;
			else
				x[i] = (x[i] + x[i - 1]) % MOD;
	}
	// printf("%d\n", m);
	for (int i = 1; i <= m; i++) {
		scanf("%lld", &ta);
		if (m % 4 == 3 && i % 2 == 0)
			ta = MOD - ta;
		// printf("%lld %lld\n",x[i],x[i] > 50000? x[i] - MOD:x[i]);
		ans = (ans + x[i] * (ta % MOD) % MOD) % MOD;
	}
	printf("%lld\n", ans);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n, m, k;
long long x[200005], fac[200005], inv[200005], ans, ta;
const long long MOD = 1000000007;

long long po(long long b, long long p) {
	if (!p)
		return 1;
	if (p & 1)
		return po(b, p - 1) * b % MOD;
	long long t = po(b, p >> 1);
	return t * t % MOD;
}

int main() {
	scanf("%d", &n);
	m = n;
	while (m % 4 != 1)
		m--;
	fac[0] = inv[0] = 1;
	k = (m - 1) / 2;
	for (int i = 1; i <= k; i++)
		inv[i] = po(fac[i] = fac[i - 1] * i % MOD, MOD - 2);
	for (int i = 1; i <= m; i++)
		if (i % 2)
			x[i] = fac[k] * inv[(i - 1) / 2] % MOD * inv[k - (i - 1) / 2] % MOD;
	if (m != n) {
		m++;
		for (int i = m; i; i--)
			x[i] = (x[i - 1] + x[i]) % MOD;
	}
	if (m != n) {
		m++;
		for (int i = m; i; i--)
			if (i % 2)
				x[i] = (x[i] - x[i - 1] + MOD) % MOD;
			else
				x[i] = (-x[i] - x[i - 1] + MOD + MOD) % MOD;
	}
	if (m != n) {
		m++;
		for (int i = m; i; i--)
			if (i % 2)
				x[i] = (x[i] - x[i - 1] + MOD) % MOD;
			else
				x[i] = (x[i] + x[i - 1]) % MOD;
	}
	for (int i = 1; i <= m; i++) {
		scanf("%lld", &ta);
		ans = (ans + x[i] * ta) % MOD;
	}
	printf("%lld\n", ans);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

typedef long long ll;

const int Maxn = 200005;
const int mod = 1000000007;

int fac[Maxn], inv[Maxn];
int n;
vector <int> V;

int Inv(int a)
{
	int p = mod - 2;
	int res = 1;
	while (p) {
		if (p & 1) res = ll(res) * a % mod;
		p >>= 1; a = ll(a) * a % mod;
	}
	return res;
}

int C(int n, int k)
{
	if (n < 0 || k < 0 || k > n) return 0;
	return ll(fac[n]) * inv[k] % mod * inv[n - k] % mod;
}

void Simple(bool plus)
{
	vector <int> nV;
	for (int i = 0; i + 1 < V.size(); i++) {
		if (plus) nV.push_back((V[i] + V[i + 1]) % mod);
		else nV.push_back((V[i] - V[i + 1] + mod) % mod);
		plus = !plus;
	}
	V = nV;
}

int Solve()
{
	int n = V.size() / 2;
	int res = 0;
	for (int i = 0; i < V.size(); i += 2)
		res = (res + ll(V[i]) * C(n, i / 2)) % mod;
	return res;
}

int main()
{
	fac[0] = inv[0] = 1;
	for (int i = 1; i < Maxn; i++) {
		fac[i] = ll(i) * fac[i - 1] % mod;
		inv[i] = Inv(fac[i]);
	}
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int a; scanf("%d", &a);
		V.push_back(a);
	}
	bool plus = true;
	while (true)
		if (V.size() % 4 == 1) { printf("%d\n", Solve()); return 0; }
		else {
			Simple(plus);
			if (V.size() % 2) plus = !plus;
		}
	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

const int Maxn = 200005;
const int mod = 1000000007;

int n;
vector <int> V;

void Simple(bool plus)
{
	vector <int> nV;
	for (int i = 0; i + 1 < V.size(); i++) {
		if (plus) nV.push_back((V[i] + V[i + 1]) % mod);
		else nV.push_back((V[i] - V[i + 1] + mod) % mod);
		plus = !plus;
	}
	V = nV;
}

void Complex()
{
	int p = 1;
	while (2 * p <= V.size()) p *= 2;
	vector <int> nV(int(V.size()) - p + 1);
	int sum = 0;
	for (int i = 0; i < p - 2; i++)
		if (i % 2 == 0) sum = (sum + V[i]) % mod;
		else sum = (sum - V[i] + mod) % mod;
	for (int i = 0; i + p <= V.size(); i += 2) {
		sum = (sum + V[i + p - 2]) % mod;
		sum = (sum - V[i + p - 1] + mod) % mod;
		nV[i] = sum;
		sum = (sum - V[i] + mod) % mod;
		sum = (sum + V[i + 1]) % mod;
	}
	sum = 0;
	for (int i = 1; i < p - 1; i++)
		sum = (sum + V[i]) % mod;
	for (int i = 1; i + p <= V.size(); i += 2) {
		sum = (sum + V[i + p - 2]) % mod;
		sum = (sum + V[i + p - 1]) % mod;
		nV[i] = sum;
		sum = (sum - V[i] + mod) % mod;
		sum = (sum - V[i + 1] + mod) % mod;
	}
	V = nV;
}

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int a; scanf("%d", &a);
		V.push_back(a);
	}
	bool plus = true;
	while (V.size() > 1) {
		if (V.size() % 2) Simple(plus);
		else if (V.size() == 2) { printf("%d\n", (V[0] + V[1]) % mod); return 0; }
		else Complex();
	}
	printf("%d\n", V[0]);
	return 0;
}


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

int main()
{
   int n;
   cin>>n;
   cin.ignore();
   int gt=0 , ans=1,  c=0;
   for(int i=0; i<n ;i++)
   {
       string s;
       getline(cin,s);
        int  h=stoi(s.substr(1,2)), m=stoi(s.substr(4,2)),tmiute=(h*60)+m;
        char d =s[7];
        if(d=='a' &&h==12)
            {
                h=0;m=m;
            }
        else if ((d=='a' && h!=12)||(d=='p' && h==12))
            {
                h=h;m=m;
            }
        else if(d=='p'&&h!=12)
            {
            h=h+12;m=m;
            }
        int t=(h*60)+m;
       if(i==0)
        {gt=t; ans++;}
         if(gt<t)
        {
            gt=t;
        }
        else if(gt>t)
        {
            ans++;
            gt=t;
        }
        else
        {
            if(c==10)
            {
                ans++;
                c=0;
            }
            else
                {
                    c++;

                }
        }
   }
cout<<ans;
    return 0;

   }

/*
21
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
*/


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

int main()
{
   int n,total=1 ,c=0 , time=-1;
   cin>>n;
   cin.ignore();
    //int gh=0,gm=0;
   char gd;
   for(int i=0;i<n;i++)
   {    int t=0;
       string s;

       getline(cin,s);
        char d=s[7];
        int  h=stoi(s.substr(1,2)), m=stoi(s.substr(4,2)),tmiute=(h*60)+m;
        if(d=='a')
        {   if(h==12)
            t=m;
            else
                t=(h*60)+m;
        }
        else
        {
            if(h==12)
                t=(((h*0)+12)*60)+m;
            else
            t=((h+12)*60)+m;

        }
        //cout<<t<<endl;
            if(t>time)
                time=t;
            else if(t<time)
            {
                time=t;
                total++;
            }
            else if(t==time)
            {
                if(c>10)
                {
                    c=0;
                    total++;
                }
                else
                    c++;
            }
            //cout<<total<<endl;
        }

cout<<total;
    return 0;

   }

/*
14
[10:19 a.m.]: iC ySL
[06:44 a.m.]: F yD
[06:44 a.m.]: i ZtfBlWwC
[06:44 a.m.]: K F f t Feq
[06:44 a.m.]: Vt vJj cRkqG  mN
[06:44 a.m.]: Ca
[06:44 a.m.]: cC
[06:44 a.m.]: aqIM  FQIahCaVxdwCEG
[04:13 a.m.]: WKeux icvt
[12:44 a.m.]: mC
[02:46 p.m.]: qEM kbX  q
[10:36 p.m.]: WFym ja W s ab
[03:07 p.m.]: xMV hC u
[12:40 p.m.]: U
*/


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

int main()
{
   int n,total=1 ,c=0 , time=-1;
   cin>>n;
   cin.ignore();
    //int gh=0,gm=0;
   char gd;
   for(int i=0;i<n;i++)
   {    int t=0;
       string s;

       getline(cin,s);
        char d=s[7];
        int  h=stoi(s.substr(1,2)), m=stoi(s.substr(4,2)),tmiute=(h*60)+m;
        if(d=='a')
        {   if(h==12)
            t=(h*60*0)+m;
            else
                t=(h*60)+m;
        }
        else
        {
            t=((h+12)*60)+m;

        }
        //cout<<t<<endl;
            if(t>time)
                time=t;
            else if(t<time)
            {
                time=t;
                total++;
            }
            else if(t==time)
            {
                if(c>10)
                {
                    c=0;
                    total++;
                }
                else
                    c++;
            }
        }

       // cout<<t<<endl;

cout<<total;
    return 0;

   }

/*
4
[07:23 p.m.]: y vTNVMa VWxb  rpE
[12:00 a.m.]: wkr EcZc
[05:16 a.m.]: nWf lypg NT
[04:22 a.m.]: UQIXmL
*/


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

int main()
{
   int n;
   cin>>n;
   cin.ignore();
   int gt , ans=0 ,  c=0;
   for(int i=0; i<n ;i++)
   {
       string s;
       getline(cin,s);
        int  h=stoi(s.substr(1,2)), m=stoi(s.substr(4,2)),tmiute=(h*60)+m;
        char d =s[7];
        if(d=='a' &&h==12)
            {
                h=0;m=m;
            }
        else if ((d=='a' && h!=12)||(d=='p' && h==12))
            {
                h=h;m=m;
            }
        else if(d=='p'&&h!=12)
            {
            h=h+12;m=m;
            }
        int t=(h*60)+m;
//        if(i=0)
//        {gt=t; ans++;}
         if(gt<t)
        {
            gt=t;
        }
        else if(gt>t)
        {
            ans++;
            gt=t;
        }
        else
        {
            if(c>10)
            {
                ans++;
            }
            else
                c++;
        }
   }
cout<<ans;
    return 0;

   }

/*
14
[10:19 a.m.]: iC ySL
[06:44 a.m.]: F yD
[06:44 a.m.]: i ZtfBlWwC
[06:44 a.m.]: K F f t Feq
[06:44 a.m.]: Vt vJj cRkqG  mN
[06:44 a.m.]: Ca
[06:44 a.m.]: cC
[06:44 a.m.]: aqIM  FQIahCaVxdwCEG
[04:13 a.m.]: WKeux icvt
[12:44 a.m.]: mC
[02:46 p.m.]: qEM kbX  q
[10:36 p.m.]: WFym ja W s ab
[03:07 p.m.]: xMV hC u
[12:40 p.m.]: U
*/


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

int main()
{
   int n,total=0 ,c=0 , time=0;
   cin>>n;
   cin.ignore();
    //int gh=0,gm=0;
   char gd;
   for(int i=0;i<n;i++)
   {    int t=0;
       string s;

       getline(cin,s);
        char d=s[7];
        int  h=stoi(s.substr(1,2)), m=stoi(s.substr(4,2)),tmiute=(h*60)+m;
       // cout<<h<<endl;
        if(gd=='a')
        {   if(h==12)
                t=0;
            //t=(h*60)+m;
            else
                t=h;
        }
        else if(gd=='p')
        {
            //t=((h+12)*60)+m;
            t=h+12;
        }
        if(i==0)
        {
            gd=d;
            time=t;
           total++;
        }
        else
        {
            if(t>time)
                time=t;
            else if(t<time)
            {
                time=t;
                total++;
            }
            else if(t==time)
            {
                if(c>10)
                {
                    c=0;
                    total++;
                }
                else
                    c++;
            }
        }

       // cout<<t<<endl;

   }
   cout<<total;
    return 0;
}

/*
4
[07:23 p.m.]: y vTNVMa VWxb  rpE
[12:00 a.m.]: wkr EcZc
[05:16 a.m.]: nWf lypg NT
[04:22 a.m.]: UQIXmL
*/


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

int main()
{
   int n;
   cin>>n;
   cin.ignore();
   int gt=0 , ans=1,  c=0;
   for(int i=0; i<n ;i++)
   {
       string s;
       getline(cin,s);
        int  h=stoi(s.substr(1,2)), m=stoi(s.substr(4,2)),tmiute=(h*60)+m;
        char d =s[7];
        if(d=='a' &&h==12)
            {
                h=0;m=m;
            }
        else if ((d=='a' && h!=12)||(d=='p' && h==12))
            {
                h=h;m=m;
            }
        else if(d=='p'&&h!=12)
            {
            h=h+12;m=m;
            }
        int t=(h*60)+m;
//        if(i=0)
//        {gt=t; ans++;}
         if(gt<t)
        {
            gt=t;
        }
        else if(gt>t)
        {
            ans++;
            gt=t;
        }
        else
        {
            if(c==10)
            {
                ans++;
                c=0;
            }
            else
                {
                    c++;

                }
        }
   }
cout<<ans;
    return 0;

   }

/*
21
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
*/


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

int main()
{
   int n;
   cin>>n;
   cin.ignore();
   int gt , ans=0 ,  c=0;
   for(int i=0; i<n ;i++)
   {
       string s;
       getline(cin,s);
        int  h=stoi(s.substr(1,2)), m=stoi(s.substr(4,2)),tmiute=(h*60)+m;
        char d =s[7];
        if(d=='a' &&h==12)
            {
                h=0;m=m;
            }
        else if ((d=='a' && h!=12)||(d=='p' && h==12))
            {
                h=h;m=m;
            }
        else if(d=='p'&&h!=12)
            {
            h=h+12;m=m;
            }
        int t=(h*60)+m;
//        if(i=0)
//        {gt=t; ans++;}
         if(gt<t)
        {
            gt=t;
        }
        else if(gt>t)
        {
            ans++;
            gt=t;
        }
        else
        {
            if(c>10)
            {
                ans++;
                c=1;
            }
            else
                c++;
        }
   }
cout<<ans;
    return 0;

   }

/*
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
*/


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

int main()
{
   int n,total=1 ,c=0 , time=-1;
   cin>>n;
   cin.ignore();
    //int gh=0,gm=0;
   char gd;
   for(int i=0;i<n;i++)
   {    int t=0;
       string s;

       getline(cin,s);
        char d=s[7];
        int  h=stoi(s.substr(1,2)), m=stoi(s.substr(4,2)),tmiute=(h*60)+m;
        if(d=='a')
        {   if(h==12)
            t=m;
            else
                t=(h*60)+m;
        }
        else
        {
            if(h==12)
                t=(((h*0)+12)*60)+m;
            else
            t=((h+12)*60)+m;

        }
        //cout<<t<<endl;
            if(t>time)
                time=t;
            else if(t<time)
            {
                time=t;
                total++;
            }
            else if(t==time)
            {
                if(c>10)
                {
                    c=1;
                    total++;
                }
                else
                    c++;
            }
            //cout<<total<<endl;
        }

cout<<total;
    return 0;

   }

/*
14
[10:19 a.m.]: iC ySL
[06:44 a.m.]: F yD
[06:44 a.m.]: i ZtfBlWwC
[06:44 a.m.]: K F f t Feq
[06:44 a.m.]: Vt vJj cRkqG  mN
[06:44 a.m.]: Ca
[06:44 a.m.]: cC
[06:44 a.m.]: aqIM  FQIahCaVxdwCEG
[04:13 a.m.]: WKeux icvt
[12:44 a.m.]: mC
[02:46 p.m.]: qEM kbX  q
[10:36 p.m.]: WFym ja W s ab
[03:07 p.m.]: xMV hC u
[12:40 p.m.]: U
*/


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

int main()
{
   int n,total=1 ,c=0 , time=-1;
   cin>>n;
   cin.ignore();
    //int gh=0,gm=0;
   char gd;
   for(int i=0;i<n;i++)
   {    int t=0;
       string s;

       getline(cin,s);
        char d=s[7];
        int  h=stoi(s.substr(1,2)), m=stoi(s.substr(4,2)),tmiute=(h*60)+m;
        if(d=='a')
        {   if(h==12)
            t=m;
            else
                t=(h*60)+m;
        }
        else
        {
            if(h==12)
                t=(((h*0)+12)*60)+m;
            else
            t=((h+12)*60)+m;

        }
        //cout<<t<<endl;
            if(t>time)
                time=t;
            else if(t<time)
            {
                time=t;
                total++;
            }
            else if(t==time)
            {
                if(c>10)
                {
                    c=1;
                    total++;
                }
                else
                    {
                        c++;
                        if(i==n-1)
                            total++;
                    }
            }
            //cout<<total<<endl;
        }

cout<<total;
    return 0;

   }

/*
14
[10:19 a.m.]: iC ySL
[06:44 a.m.]: F yD
[06:44 a.m.]: i ZtfBlWwC
[06:44 a.m.]: K F f t Feq
[06:44 a.m.]: Vt vJj cRkqG  mN
[06:44 a.m.]: Ca
[06:44 a.m.]: cC
[06:44 a.m.]: aqIM  FQIahCaVxdwCEG
[04:13 a.m.]: WKeux icvt
[12:44 a.m.]: mC
[02:46 p.m.]: qEM kbX  q
[10:36 p.m.]: WFym ja W s ab
[03:07 p.m.]: xMV hC u
[12:40 p.m.]: U
*/


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

int main()
{
   int n;
   cin>>n;
   cin.ignore();
   int gt , ans=0 ,  c=0;
   for(int i=0; i<n ;i++)
   {
       string s;
       getline(cin,s);
        int  h=stoi(s.substr(1,2)), m=stoi(s.substr(4,2)),tmiute=(h*60)+m;
        char d =s[7];
        if(d=='a' &&h==12)
            {
                h=0;m=m;
            }
        else if ((d=='a' && h!=12)||(d=='p' && h==12))
            {
                h=h;m=m;
            }
        else if(d=='p'&&h!=12)
            {
            h=h+12;m=m;
            }
        int t=(h*60)+m;
//        if(i=0)
//        {gt=t; ans++;}
         if(gt<t)
        {
            gt=t;
        }
        else if(gt>t)
        {
            ans++;
            gt=t;
        }
        else
        {
            if(c>10)
            {
                ans++;
                c=1;
            }
            else
                {
                    c++;
                    if(i==n-1)
                        ans++;
                }
        }
   }
cout<<ans;
    return 0;

   }

/*
21
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
*/


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

int main()
{
   int n;
   cin>>n;
   cin.ignore();
   int gt=100000000 , ans=0,  c=0;
   for(int i=0; i<n ;i++)
   {
       string s;
       getline(cin,s);
        int  h=stoi(s.substr(1,2)), m=stoi(s.substr(4,2)),tmiute=(h*60)+m;
        char d =s[7];
        if(d=='a' &&h==12)
            {
                h=0;m=m;
            }
        else if ((d=='a' && h!=12)||(d=='p' && h==12))
            {
                h=h;m=m;
            }
        else if(d=='p'&&h!=12)
            {
            h=h+12;m=m;
            }
        int t=(h*60)+m;
         if(gt<t)
        {
            gt=t;
            c=0;
        }
        else if(gt>t)
        {
            ans++;
            gt=t;
            c=1;
        }
        else
        {c++;
            if(c>10)
            {
                ans++;
                c=1;
            }
        }
   }
cout<<ans;
    return 0;

   }

/*
21
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
[10:41 a.m.]: apppmama
*/


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

int main()
{
   int n,total=0 ,c=0 , time=0;
   cin>>n;
   cin.ignore();
    //int gh=0,gm=0;
   char gd;
   for(int i=0;i<n;i++)
   {
       string s;
      // cin.ignore();
       getline(cin,s);
      // cout<<s[7]<<endl;
        char d=s[7];
        int  h=stoi(s.substr(1,2));
        //cout<<s<<" ";
        int  m=stoi(s.substr(4,2));
        int tmiute=(h*60)+m;
        //cout<<h<<":"<<m<<" "<<d<<endl;
        //cout<<s.substr(1,2)<<" : "<<s.substr(4,2)<<" "<<endl;
        if(i==0)
        {
            gd=d;
           time=tmiute;
           total++;
        }
        else if(gd==d && tmiute > time)
        {
            time=tmiute;
        }
        else if(gd==d && tmiute < time)
        {
            time=tmiute;
            total++;
        }
        else if(gd==d && tmiute==time)
        {
            if(c<=10)
            {
                c++;
            }
            else
            {
                c=1;
                total++;
            }
        }
        else if(d>gd)
        {
            gd=d;
            time=tmiute;
        }
        else if(d<gd)
        {
            gd=d;
            total++;
            time=tmiute;
        }

//cout<<total<<endl;

   }
   cout<<total;
    return 0;
}
/*
1
[05:00 a.m.]: Server is started
*/


/* -*- coding: utf-8 -*-
 *
 * 0016D.cc: D. Logging
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

/* global variables */

char s[128];

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);
  while (getchar() != '\n');

  int d = 1, pt = -1, pn = 0;
  while (n--) {
    fgets(s, 128, stdin);

    int hh = (s[1] - '0') * 10 + (s[2] - '0');
    int mm = (s[4] - '0') * 10 + (s[5] - '0');
    if (hh == 12) hh = 0;
    if (s[7] == 'p') hh += 12;
    //printf("%02d:%02d\n", hh, mm);

    int t = hh * 60 + mm;
    if (pt != t) {
      if (pt > t) d++;
      pt = t;
    }
    else {
      if (++pn > 10) d++, pn = 0;
    }
  }

  printf("%d\n", d);
  return 0;
}


/* -*- coding: utf-8 -*-
 *
 * 0016D.cc: D. Logging
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

/* global variables */

char s[128];

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);
  while (getchar() != '\n');

  int d = 1, pt = -1, pn = 0;
  while (n--) {
    fgets(s, 128, stdin);

    int hh = (s[1] - '0') * 10 + (s[2] - '0');
    int mm = (s[4] - '0') * 10 + (s[5] - '0');
    if (hh == 12) hh = 0;
    if (s[7] == 'p') hh += 12;
    //printf("%02d:%02d\n", hh, mm);

    int t = hh * 60 + mm;
    if (pt != t) {
      if (pt > t) d++;
      pt = t;
      pn = 1;
    }
    else {
      if (++pn > 10) d++, pn = 1;
    }
  }

  printf("%d\n", d);
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  maxn = 1e6 + 5;
const int N = 1e4 + 5;

char s[N];

int main(){
	int n;scanf("%d",&n);getchar();
	int x,y,u,v;
	char c,d;
	int cnt=0;
	int tot=1;
	for(int i=1;i<=n;i++){
		scanf("[%d:%d %c",&x,&y,&c);
		gets(s);
		cnt++;
		if((x>=u&&y>=v&&c==d) || (d=='a'&&c=='p')) cnt--;
		if(x==u&&y==v&&c==d) tot++;
		if(tot>10) cnt++,tot=1;
		u=x,v=y,d=c;
	}
	cout<<cnt<<'\n';
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  maxn = 1e6 + 5;
const int N = 1e4 + 5;

char s[N];

int main(){
	int n;scanf("%d",&n);getchar();
	int x,y,u=12,v=59;
	char c,d='p';
	int cnt=0;
	int tot=1;
	for(int i=1;i<=n;i++){
		scanf("[%d:%d %c",&x,&y,&c);
		gets(s);
		cnt++;
		if((((x==u && y>=v)|| (x>u))&&c==d) || (d=='a'&&c=='p')) cnt--;
		if(x==u&&y==v&&c==d) tot++;
		if(tot>10) cnt++,tot=1;
		// cout<<"u="<<u<<" v="<<v<<" d="<<d;
		// cout<<" x="<<x<<" y="<<y<<" c="<<c<<'\n';
		u=x,v=y,d=c;
	}
	cout<<cnt<<'\n';
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  maxn = 1e6 + 5;
const int N = 1e4 + 5;

char s[N];

int main(){
	int n;scanf("%d",&n);getchar();
	int x,y,u=100,v=0;
	char c;
	int cnt=0;
	int tot=1;
	for(int i=1;i<=n;i++){
		scanf("[%d:%d %c",&x,&y,&c);
		gets(s);
		x%=12;
		if(c=='p') x+=12;
		if(x*60+y<u*60+v) cnt++;
		if(x*60+y==u*60+v) tot++;
		else tot=1;
		if(tot>10) cnt++,tot=1;
		// cout<<"u="<<u<<" v="<<v<<" d="<<d;
		// cout<<" x="<<x<<" y="<<y<<" c="<<c<<'\n';
		u=x,v=y;
	}
	cout<<cnt<<'\n';
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  maxn = 1e6 + 5;
const int N = 1e4 + 5;

char s[N];

int main(){
	int n;scanf("%d",&n);getchar();
	int x,y,u=100,v=0;
	char c;
	int cnt=0;
	int tot=1;
	for(int i=1;i<=n;i++){
		scanf("[%d:%d %c",&x,&y,&c);
		gets(s);
		x%=12;
		if(c=='p') x+=12;
		if(x*60+y<u*60+v) cnt++;
		if(x*60+y==u*60+v) tot++;
		if(tot>10) cnt++,tot=1;
		// cout<<"u="<<u<<" v="<<v<<" d="<<d;
		// cout<<" x="<<x<<" y="<<y<<" c="<<c<<'\n';
		u=x,v=y;
	}
	cout<<cnt<<'\n';
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  maxn = 1e6 + 5;
const int N = 1e4 + 5;

char s[N];

int main(){
	int n;scanf("%d",&n);getchar();
	int x,y,u,v;
	char c,d;
	int cnt=1;
	int tot=1;
	for(int i=1;i<=n;i++){
		scanf("[%d:%d %c",&x,&y,&c);
		gets(s);
		if(i!=1){
			cnt++;
			if((x>=u&&y>=v&&c==d) || (d=='a'&&c=='p')) cnt--;
			if(x==u&&y==v&&c==d) tot++;
			if(tot>10) cnt++,tot=1;
		}
		u=x,v=y,d=c;
	}
	cout<<cnt<<'\n';
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    scanf("%d\n",&n);
    string s1;
    int a[n+5],ans=1,dem=1;
    for(int i=0;i<n;i++){
        getline(cin,s1);
        int h=0,m=0,st=0,stt=0;
        for(int j=0;j<s1.length();j++){
            if(s1[j]>='0' && s1[j]<='9'){
                if(st) m = m*10+int(s1[j]-'0');
                else h = h*10+int(s1[j]-'0');
            }
            if(s1[j]=='p')stt=720;
            if(s1[j]==':')h*=60,st=1;
            if(s1[j]==']')break;
        }
        a[i]=h+m+stt;
    }
    for(int i=1;i<n;i++){
        if(a[i]<a[i-1])ans++,dem=1;
        else if(a[i]==a[i-1]){
            if(dem ==10 )ans++,dem=1;
            else dem++;
        }else dem++;
    }
    cout<<ans;
}


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

#define ll long long
#define ld long double
#define S second
#define F first
#define ii pair <int,int>
int n ;
string s;
vector<int> v;
map<pair<int,string>,int> mp;
int main()
{
    scanf("%d\n",&n);
    for(int i = 0 ; i < n ; i++)
    {
        getline(cin,s);
        int t = (s[1] - '0') * 1000;
        t += (s[2] - '0') * 100;
        t += (s[4] - '0') * 10;
        t += (s[5] - '0');
        if(s[7] == 'p')
            t += 1200;
        if(t == 1200)
            t = 0;
        if(t == 2400)
            t = 1200;
        v.push_back(t);
        string d = s.substr(14);
        mp[{t,s}]++;
    }
    int ans = 1;
    for(int i = 1 ; i < n ; i++)
    {
        if(v[i] < v[i-1])
            ans++;
    }
    for(auto x:mp)
        ans+= x.S/10;
    cout<<ans;
}


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

#define ll long long
#define ld long double
#define S second
#define F first
#define ii pair <int,int>
int n ;
string s;
vector<int> v;
int main()
{
    scanf("%d\n",&n);
    for(int i = 0 ; i < n ; i++)
    {
        getline(cin,s);
        int t = (s[1] - '0') * 1000;
        t += (s[2] - '0') * 100;
        t += (s[4] - '0') * 10;
        t += (s[5] - '0');
        if(s[7] == 'p')
            t += 1200;
        if(t >= 1200 && t <1260)
            t -= 1200;
        if(t >= 2400 && t < 2460)
            t -= 1200;
        v.push_back(t);
    }
    int ans = 1;
    int c = 1;
    for(int i = 1 ; i < n ; i++)
    {
        if(v[i] < v[i-1])
        {
            ans++;
            c = 1;        }
        else if (v[i] == v[i-1])
        {
            c++;
            if(c == 11)
            {
                c = 1;
                ans++;
            }
        }
        else
            c = 1;
    }
    cout<<ans;
}


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

#define ll long long
#define ld long double
#define S second
#define F first
#define ii pair <int,int>
int n ;
string s;
vector<int> v;
map<int,int> mp;
int main()
{
    scanf("%d\n",&n);
    for(int i = 0 ; i < n ; i++)
    {
        getline(cin,s);
        int t = (s[1] - '0') * 1000;
        t += (s[2] - '0') * 100;
        t += (s[4] - '0') * 10;
        t += (s[5] - '0');
        if(s[7] == 'p')
            t += 1200;
        if(t == 1200)
            t = 0;
        if(t == 2400)
            t = 1200;
        v.push_back(t);
        //string d = s.substr(14);
//        cout<<d<<endl;
        //mp[{t,s}]++;
        mp[t]++;
    }
    int ans = 1;
    for(int i = 1 ; i < n ; i++)
    {
        if(v[i] < v[i-1])
            ans++;
    }
    for(auto x:mp)
        ans+= x.S/10;
    cout<<ans;
}


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

#define ll long long
#define ld long double
#define S second
#define F first
#define ii pair <int,int>
int n ;
string s;
vector<int> v;
map<int,int> mp;
int main()
{
    scanf("%d\n",&n);
    for(int i = 0 ; i < n ; i++)
    {
        getline(cin,s);
        int t = (s[1] - '0') * 1000;
        t += (s[2] - '0') * 100;
        t += (s[4] - '0') * 10;
        t += (s[5] - '0');
        if(s[7] == 'p')
            t += 1200;
        if(t >= 1200 && t <1260)
            t -= 1200;
        if(t >= 2400 && t < 2460)
            t -= 1200;
        v.push_back(t);
        //string d = s.substr(14);
//        cout<<d<<endl;
        //mp[{t,s}]++;
        mp[t]++;
    }
    int ans = 1;
    for(int i = 1 ; i < n ; i++)
    {
        if(v[i] < v[i-1])
            ans++;
    }
    for(auto x:mp)
        ans+= x.S/10;
    cout<<ans;
}


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

#define ll long long
#define ld long double
#define S second
#define F first
#define ii pair <int,int>
int n ;
string s;
vector<int> v;
int main()
{
    scanf("%d\n",&n);
    for(int i = 0 ; i < n ; i++)
    {
        getline(cin,s);
        int t = (s[1] - '0') * 1000;
        t += (s[2] - '0') * 100;
        t += (s[4] - '0') * 10;
        t += (s[5] - '0');
        if(s[7] == 'p')
            t += 1200;
        v.push_back(t);

    }
    int ans = 1;
    int last = v[0];
    int c = 1;
    for(int i = 1 ; i < n ; i++)
    {
        if(v[i] == last)
        {
            c++;
            if(c > 10)
            {
                ans++;
                c = 1;
            }
        }
        else
        {
            c = 1;
            if(v[i] < v[i-1])
                ans++;
        }
        last = v[i];
    }
    cout<<ans;
}


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

int main()
{
	int n, ans=1;
    string s;
    cin>>n;
	getline(cin,s);
	int last=0, c=1;
	for(int i=1;i<=n;i++)
	{
		getline(cin,s);
		int x=((s[1]-'0')*10+(s[2]-'0'))%12*60+(s[4]-'0')*10+(s[5]-'0')+(s[7]=='p')*720;
		if(x==last)
		{
			c=c+1;
			if(c>10)
			{
				ans+=1;
				c=1;
			}
		}
		else
		{
			c=1;
		}
			if(x<last)
		            {
		            last=x;
		            ans+=1;}
		else
		{
		last=x;
		ans+=0;}
	}
	cout<<ans;
	return 0;
}


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

int main()
{
	int n, ans=1;
    string s;
	cin>>n;
	getline(cin,s);
	int last=0;
	for(int i=1;i<=n;i++)
	{
		getline(cin,s);
		int x=((s[1]-'0')*10+(s[2]-'0'))%12*60+(s[4]-'0')*10+(s[5]-'0')+(s[7]=='p')*720;
		if(x<last)
		            {
		            last=x;
		            ans+=1;}
		else
		{
		last=x;
		ans+=0;}
	}
	cout<<ans;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;int flag = 0;
    int ans = 0, count = 0;
    string s, s2;
    vector<double> times;
    cin >> n;
    cin.ignore(256,'\n');;
    for (int i = 0; i < n; ++i) {
        getline(cin, s);
        if(n>=25 && ((s[2]=='8'&&i==0) || flag==1))
        {
            //cout<<s<<endl;
            flag = 1;
        }
        s2 = s.substr(1, 5);
        s2[2] = '.';
        if (s[7] == 'a') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2)-12.00);}
            else{times.push_back(stod(s2));}
        }
        else if (s[7] == 'p') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2));}
            else{times.push_back(stod(s2)+12.00);}
        }
        //cout<<times[i]<<endl;
    }
    ++ans;int l = 1;
    if(flag==1)
    {
        for (int k = 0; i < times.size(); ++i) {
            cout<<times[k]<<",";
            l++;
            if(l == 5){
                l=0; cout<<endl;
            }

    }
    }
    for (int i = 1; i < times.size(); ++i) {
        //cout<<times[i-1]<<" "<<times[i]<<endl;
        if (times[i - 1] == times[i]){
            count++;
        }

        if (times[i - 1] > times[i]) {
            ++ans;
        }

        if(count == 10){
            ++ans; count = 0;
        }
    }
    if(n<=25){
    cout << ans << endl;}
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    int ans = 0, count = 0;
    string s, s2;
    vector<double> times;
    cin >> n;
    cin.ignore(256, '\n');
    ;
    for (int i = 0; i < n; ++i) {
        getline(cin, s);
        s2 = s.substr(1, 5);
        s2[2] = '.';
        if (s[7] == 'a') {
            if (stod(s2) >= 12.00 && stod(s2) < 13.00) {
                times.push_back(stod(s2) - 12.00);
            }
            else {
                times.push_back(stod(s2));
            }
        }
        else if (s[7] == 'p') {
            if (stod(s2) >= 12.00 && stod(s2) < 13.00) {
                times.push_back(stod(s2));
            }
            else {
                times.push_back(stod(s2) + 12.00);
            }
        }
        //cout<<times[i]<<endl;
    }
    ++ans;
    for (int i = 1; i < times.size(); ++i) {
        //cout<<times[i-1]<<" "<<times[i]<<endl;
        if (times[i - 1] == times[i]) {
            count++;
            if (count == 10) {
                ++ans;
                count = 0;
            }
        }

        else if (times[i - 1] > times[i]) {
            ++ans;
        }

        else {
            count = 1;
        }
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    int ans = 0, count = 0;
    string s, s2;
    vector<double> times;
    cin >> n;
    cin.ignore(256, '\n');
    ;
    for (int i = 0; i < n; ++i) {
        getline(cin, s);
        s2 = s.substr(1, 5);
        s2[2] = '.';
        if (s[7] == 'a') {
            if (stod(s2) >= 12.00 && stod(s2) < 13.00) {
                times.push_back(stod(s2) - 12.00);
            }
            else {
                times.push_back(stod(s2));
            }
        }
        else if (s[7] == 'p') {
            if (stod(s2) >= 12.00 && stod(s2) < 13.00) {
                times.push_back(stod(s2));
            }
            else {
                times.push_back(stod(s2) + 12.00);
            }
        }
        //cout<<times[i]<<endl;
    }
    ++ans;
    for (int i = 1; i < times.size(); ++i) {
        //cout<<times[i-1]<<" "<<times[i]<<endl;
        if (times[i - 1] < times[i]) {
            count = 1;
        }

        else if (times[i - 1] > times[i]) {
            ++ans;count = 1;
        }

        else if (times[i - 1] == times[i]) {
            count++;
            if (count > 10) {
                ++ans;
                count = 1;
            }
        }
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;int flag = 0;
    int ans = 0, count = 0;
    string s, s2;
    vector<double> times;
    cin >> n;
    cin.ignore(256,'\n');;
    for (int i = 0; i < n; ++i) {
        getline(cin, s);
        if(n>=25 && ((s[2]=='8'&&i==0) || flag==1))
        {
            //cout<<s<<endl;
            flag = 1
        }
        s2 = s.substr(1, 5);
        s2[2] = '.';
        if (s[7] == 'a') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2)-12.00);}
            else{times.push_back(stod(s2));}
        }
        else if (s[7] == 'p') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2));}
            else{times.push_back(stod(s2)+12.00);}
        }
        //cout<<times[i]<<endl;
    }
    ++ans;int l = 1;
    if(flag==1)
    {
        for (int k = 0; i < times.size(); ++i) {
            cout<<times[k];<<",";
            l++;
            if(l =5){
                l=0; cout<<endl;
            }

    }
    }
    for (int i = 1; i < times.size(); ++i) {
        //cout<<times[i-1]<<" "<<times[i]<<endl;
        if (times[i - 1] == times[i]){
            count++;
        }

        if (times[i - 1] > times[i]) {
            ++ans;
        }

        if(count == 10){
            ++ans; count = 0;
        }
    }
    if(n<=25){
    cout << ans << endl;}
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;int flag = 0;
    int ans = 0, count = 0;
    string s, s2;
    vector<double> times;
    cin >> n;
    cin.ignore(256,'\n');;
    for (int i = 0; i < n; ++i) {
        getline(cin, s);
        if(n>=25 && ((s[2]=='8'&&i==0) || flag==1))
        {
            cout<<s<<endl;
            flag = 1
        }
        s2 = s.substr(1, 5);
        s2[2] = '.';
        if (s[7] == 'a') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2)-12.00);}
            else{times.push_back(stod(s2));}
        }
        else if (s[7] == 'p') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2));}
            else{times.push_back(stod(s2)+12.00);}
        }
        //cout<<times[i]<<endl;
    }
    ++ans;
    for (int i = 1; i < times.size(); ++i) {
        //cout<<times[i-1]<<" "<<times[i]<<endl;
        if (times[i - 1] == times[i]){
            count++;
        }

        if (times[i - 1] > times[i]) {
            ++ans;
        }

        if(count == 10){
            ++ans; count = 0;
        }
    }
    if(n<=25){
    cout << ans << endl;}
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;int flag = 0;
    int ans = 0, count = 0;
    string s, s2;
    vector<double> times;
    cin >> n;
    cin.ignore(256,'\n');;
    for (int i = 0; i < n; ++i) {
        getline(cin, s);
        if(n>=25 && ((s[2]=='8'&&i==0) || flag==1))
        {
            //cout<<s<<endl;
            flag = 1;
        }
        s2 = s.substr(1, 5);
        s2[2] = '.';
        if (s[7] == 'a') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2)-12.00);}
            else{times.push_back(stod(s2));}
        }
        else if (s[7] == 'p') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2));}
            else{times.push_back(stod(s2)+12.00);}
        }
        //cout<<times[i]<<endl;
    }
    ++ans;int l = 1;
    if(flag==1)
    {
        for (int k = 0; k < times.size(); ++k) {
            cout<<times[k]<<",";
            l++;
            if(l == 5){
                l=0; cout<<endl;
            }

    }
    }
    for (int i = 1; i < times.size(); ++i) {
        //cout<<times[i-1]<<" "<<times[i]<<endl;
        if (times[i - 1] == times[i]){
            count++;
        }

        if (times[i - 1] > times[i]) {
            ++ans;
        }

        if(count == 10){
            ++ans; count = 0;
        }
    }
    if(n<=25){
    cout << ans << endl;}
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;int flag = 0;
    int ans = 0, count = 0;
    string s, s2;
    vector<double> times;
    cin >> n;
    cin.ignore(256,'\n');;
    for (int i = 0; i < n; ++i) {
        getline(cin, s);
        if(n>=25 && ((s[2]=='8'&&i==0) || flag==1))
        {
            cout<<s<<endl;
            flag = 1;
        }
        s2 = s.substr(1, 5);
        s2[2] = '.';
        if (s[7] == 'a') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2)-12.00);}
            else{times.push_back(stod(s2));}
        }
        else if (s[7] == 'p') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2));}
            else{times.push_back(stod(s2)+12.00);}
        }
        //cout<<times[i]<<endl;
    }
    ++ans;
    for (int i = 1; i < times.size(); ++i) {
        //cout<<times[i-1]<<" "<<times[i]<<endl;
        if (times[i - 1] == times[i]){
            count++;
        }

        if (times[i - 1] > times[i]) {
            ++ans;
        }

        if(count == 10){
            ++ans; count = 0;
        }
    }
    if(n<=25){
    cout << ans << endl;}
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;int flag = 0;
    int ans = 0, count = 0;
    string s, s2;
    vector<double> times;
    cin >> n;
    cin.ignore(256,'\n');;
    for (int i = 0; i < n; ++i) {
        getline(cin, s);
        if(n>=25 && ((s[2]=='8'&&i==0) || flag==1))
        {
            cout<<s<<endl;
            flag = 1
        }
        s2 = s.substr(1, 5);
        s2[2] = '.';
        if (s[7] == 'a') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2)-12.00);}
            else{times.push_back(stod(s2));}
        }
        else if (s[7] == 'p') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2));}
            else{times.push_back(stod(s2)+12.00);}
        }
        //cout<<times[i]<<endl;
    }
    ++ans;
    for (int i = 1; i < times.size(); ++i) {
        //cout<<times[i-1]<<" "<<times[i]<<endl;
        if (times[i - 1] == times[i]){
            count++;
        }

        if (times[i - 1] > times[i]) {
            ++ans;
        }

        if(count == 10){
            ++ans; count = 0;
        }
    }
    if(n<25){
    cout << ans << endl;}
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    int ans = 0, count = 0;
    string s, s2;
    vector<double> times;
    cin >> n;
    cin.ignore(256, '\n');
    ;
    for (int i = 0; i < n; ++i) {
        getline(cin, s);
        s2 = s.substr(1, 5);
        s2[2] = '.';
        if (s[7] == 'a') {
            if (stod(s2) >= 12.00 && stod(s2) < 13.00) {
                times.push_back(stod(s2) - 12.00);
            }
            else {
                times.push_back(stod(s2));
            }
        }
        else if (s[7] == 'p') {
            if (stod(s2) >= 12.00 && stod(s2) < 13.00) {
                times.push_back(stod(s2));
            }
            else {
                times.push_back(stod(s2) + 12.00);
            }
        }
        //cout<<times[i]<<endl;
    }
    ++ans;
    for (int i = 1; i < times.size(); ++i) {
        //cout<<times[i-1]<<" "<<times[i]<<endl;
        if (times[i - 1] == times[i]) {
            count++;
            if (count == 10) {
                ++ans;
                count = 0;
            }
        }

        else if (times[i - 1] > times[i]) {
            ++ans;count = 1;
        }

        else {
            count = 1;
        }
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;int flag = 0;
    int ans = 0, count = 0;
    string s, s2;
    vector<double> times;
    cin >> n;
    cin.ignore(256,'\n');;
    for (int i = 0; i < n; ++i) {
        getline(cin, s);
        if(n>=25 && ((s[2]=='8'&&i==0) || flag==1))
        {
            cout<<s<<endl;
            flag = 1;
        }
        s2 = s.substr(1, 5);
        s2[2] = '.';
        if (s[7] == 'a') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2)-12.00);}
            else{times.push_back(stod(s2));}
        }
        else if (s[7] == 'p') {
            if(stod(s2)>= 12.00 && stod(s2)<13.00) {times.push_back(stod(s2));}
            else{times.push_back(stod(s2)+12.00);}
        }
        //cout<<times[i]<<endl;
    }
    ++ans;
    for (int i = 1; i < times.size(); ++i) {
        //cout<<times[i-1]<<" "<<times[i]<<endl;
        if (times[i - 1] == times[i]){
            count++;
        }

        if (times[i - 1] > times[i]) {
            ++ans;
        }

        if(count == 10){
            ++ans; count = 0;
        }
    }
    if(n<25){
    cout << ans << endl;}
}


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

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

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

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

/*** Define Values ***/

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

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

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

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

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

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


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

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

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

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

/*** Define Values ***/

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

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

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

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

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

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


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

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

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

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

/*** Define Values ***/

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

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

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

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

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

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


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

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

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

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

/*** Define Values ***/

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

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

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

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

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

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


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

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

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

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

/*** Define Values ***/

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

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

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

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

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

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