#include<bits/stdc++.h>

using namespace std;

typedef long long INT;

#define NN 300010

int a[NN];

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	int n;
	cin >> n;
	INT ans = 0;

	for(int i=1; i<=n; i++) {
		scanf("%d", a+i);
	}

	INT pre = 0;

	for(int i=1; i<=n; i++) {
		if(pre >= a[i] / 2) {
			ans += a[i] / 2;
			pre -= (a[i] / 2);
			pre += a[i] % 2;
		} else {
			ans += pre;
			ans += (a[i] - pre * 2) / 3;
			pre = (a[i] - pre * 2) % 3;
		}
	}

	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(int i=a;i<b;i++)
#define repb(i,a,b)         for(ll i=a;i>=b;i--)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define tr(c,it)            for(auto const &it : c)
#define xlr8                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define sz(c)               (c).size()
#define all(c)              (c).begin(),(c).end()
#define sl(a)               scanf("%lld",&a);
#define TH                  1000
#define F                   first
#define S                   second
ll MOD=pow(10,9)+7;
ll INF=1e18+10;

int main()
{
    int n;cin>>n;
    ll in[n];
    rep(i,0,n)
    cin>>in[i];

    ll last=0,ans=0,p=0;
    rep(i,0,n-1)
    {
        ll a=in[i],b;
        if(i+1<n)
            b=in[i+1];
        else
            b=0;
        if(a<b)
        {
            ans+=2*(in[i]/3);
            in[i+1]-=(in[i]/3)*3;
            in[i]-=(in[i]/3)*3;
        }
        else
        {
            ans+=2*(in[i+1]/3);
            in[i]-=(in[i+1]/3)*3;
            in[i+1]-=(in[i+1]/3)*3;
        }
        if(in[i]==2 && in[i+1]>0)
        {
            ans+=1;
            in[i]-=2;
            in[i+1]-=1;
        }
        else if(in[i]==1 && in[i+1]>=2)
        {
            ans+=1;
            in[i]-=1;
            in[i+1]-=2;
        }
        if(in[i]==1 && last>=2)
        {
            ans+=1;
            in[i]-=1;
            last-=2;
        }
        else if(in[i]==2 && last>=1)
        {
            ans+=1;
            in[i]-=2;
            last-=1;
        }
        if(in[i]>=3)
        {
            ans+=(in[i]/3);
            in[i]-=(in[i]/3)*3;
        }
        if(in[i+1]>=3)
        {
            ans+=(in[i+1]/3);
            in[i+1]-=(in[i+1]/3)*3;
        }
        last+=in[i];
        //cout<<ans<<endl;
    }

    ll now=in[n-1]/2;
    ans+=(min(now,last));
    in[n-1]-=min(now,last);
    if(in[n-1]>=3)
        ans+=(in[n-1]/3);
    cout<<ans;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(int i=a;i<b;i++)
#define repb(i,a,b)         for(ll i=a;i>=b;i--)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define tr(c,it)            for(auto const &it : c)
#define xlr8                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define sz(c)               (c).size()
#define all(c)              (c).begin(),(c).end()
#define sl(a)               scanf("%lld",&a);
#define TH                  1000
#define F                   first
#define S                   second
ll MOD=pow(10,9)+7;
ll INF=1e18+10;

int main()
{
    int n;cin>>n;
    ll in[n];
    rep(i,0,n)
    cin>>in[i];

    ll last=0,ans=0,p=0;
    rep(i,0,n-1)
    {
        ll a=in[i],b;
        if(i+1<n)
            b=in[i+1];
        else
            b=0;
        if(a<b)
        {
            ans+=2*(in[i]/3);
            in[i+1]-=(in[i]/3)*3;
            in[i]-=(in[i]/3)*3;
        }
        else
        {
            ans+=2*(in[i+1]/3);
            in[i]-=(in[i+1]/3)*3;
            in[i+1]-=(in[i+1]/3)*3;
        }
        if(in[i]==2 && in[i+1]>0)
        {
            ans+=1;
            in[i]-=2;
            in[i+1]-=1;
        }
        else if(in[i]==1 && in[i+1]>=2)
        {
            ans+=1;
            in[i]-=1;
            in[i+1]-=2;
        }
        if(in[i]==1 && last>=2)
        {
            ans+=1;
            in[i]-=1;
            last-=2;
        }
        else if(in[i]==2 && last>=1)
        {
            ans+=1;
            in[i]-=2;
            last-=1;
        }
        if(in[i]>=3)
        {
            ans+=(in[i]/3);
            in[i]-=(in[i]/3)*3;
        }
        last+=in[i];
        //cout<<ans<<endl;
    }

    ll now=in[n-1]/2;
    ans+=(min(now,last));
    in[n-1]-=min(now,last);
    if(in[n-1]>=3)
        ans+=(in[n-1]/3);
    cout<<ans;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(int i=a;i<b;i++)
#define repb(i,a,b)         for(ll i=a;i>=b;i--)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define tr(c,it)            for(auto const &it : c)
#define xlr8                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define sz(c)               (c).size()
#define all(c)              (c).begin(),(c).end()
#define sl(a)               scanf("%lld",&a);
#define TH                  1000
#define F                   first
#define S                   second
ll MOD=pow(10,9)+7;
ll INF=1e18+10;

int main()
{
    int n;cin>>n;
    ll a[n];
    rep(i,0,n)
    cin>>a[i];

    ll last=0,ans=0;
    rep(i,0,n)
    {
        //last+=(a[i]%3);
        if(2*last>=a[i])
        {
            last-=(a[i]/2);
            ans+=(a[i]/2);
            a[i]%=2;
            if(a[i]>=3)
            {
                ans+=(a[i]/3);
                a[i]%=3;
            }
            last+=a[i];
        }
        else
        {
            ans+=(last);
            a[i]-=(2*last);
            last=0;
            if(a[i]>=3)
            {
                ans+=(a[i]/3);
                a[i]%=3;
            }
            last+=a[i];
        }
    }
    cout<<ans;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(int i=a;i<b;i++)
#define repb(i,a,b)         for(ll i=a;i>=b;i--)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define tr(c,it)            for(auto const &it : c)
#define xlr8                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define sz(c)               (c).size()
#define all(c)              (c).begin(),(c).end()
#define sl(a)               scanf("%lld",&a);
#define TH                  1000
#define F                   first
#define S                   second
ll MOD=pow(10,9)+7;
ll INF=1e18+10;

int main()
{
    int n;cin>>n;
    ll in[n];
    rep(i,0,n)
    cin>>in[i];

    ll last=0,ans=0,p=0,justlast=0;
    rep(i,0,n-1)
    {
        ll a=in[i],b;
        if(i+1<n)
            b=in[i+1];
        else
            b=0;
        if(a<b)
        {
            ans+=2*(in[i]/3);
            in[i+1]-=(in[i]/3)*3;
            in[i]-=(in[i]/3)*3;
        }
        else
        {
            ans+=2*(in[i+1]/3);
            in[i]-=(in[i+1]/3)*3;
            in[i+1]-=(in[i+1]/3)*3;
        }
        if(in[i]==2 && in[i+1]>0)
        {
            ans+=1;
            in[i]-=2;
            in[i+1]-=1;
        }
        else if(in[i]==1 && in[i+1]>=2)
        {
            ans+=1;
            in[i]-=1;
            in[i+1]-=2;
        }
        if(in[i]==1 && justlast>=2)
        {
            ans+=1;
            in[i]-=1;
            justlast-=2;
        }
        else if(in[i]==2 && last>=1)
        {
            ans+=1;
            in[i]-=2;
            last-=1;
        }
        if(in[i]>=3)
        {
            ans+=(in[i]/3);
            in[i]-=(in[i]/3)*3;
        }
        if(in[i+1]>=3)
        {
            ans+=(in[i+1]/3);
            in[i+1]-=(in[i+1]/3)*3;
        }
        last+=in[i];
        justlast=in[i];
        //cout<<ans<<endl;
    }

    ll now=in[n-1]/2;
    ans+=(min(now,last));
    in[n-1]-=min(now,last);
    if(in[n-1]>=3)
        ans+=(in[n-1]/3);
    cout<<ans;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(int i=a;i<b;i++)
#define repb(i,a,b)         for(ll i=a;i>=b;i--)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define tr(c,it)            for(auto const &it : c)
#define xlr8                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define sz(c)               (c).size()
#define all(c)              (c).begin(),(c).end()
#define sl(a)               scanf("%lld",&a);
#define TH                  1000
#define F                   first
#define S                   second
ll MOD=pow(10,9)+7;
ll INF=1e18+10;

int main()
{
    int n;cin>>n;
    ll in[n];
    rep(i,0,n)
    cin>>in[i];

    ll last=0,ans=0,p=0,justlast=0;
    rep(i,0,n-1)
    {
        ll a=in[i],b;
        if(i+1<n)
            b=in[i+1];
        else
            b=0;
        if(a<b)
        {
            ans+=2*(in[i]/3);
            in[i+1]-=(in[i]/3)*3;
            in[i]-=(in[i]/3)*3;
        }
        else
        {
            ans+=2*(in[i+1]/3);
            in[i]-=(in[i+1]/3)*3;
            in[i+1]-=(in[i+1]/3)*3;
        }
        if(in[i]==2 && in[i+1]>0)
        {
            ans+=1;
            in[i]-=2;
            in[i+1]-=1;
        }
        else if(in[i]==1 && in[i+1]>=2)
        {
            ans+=1;
            in[i]-=1;
            in[i+1]-=2;
        }
        if(in[i]==1 && justlast>=2)
        {
            ans+=1;
            in[i]-=1;
            justlast-=2;
            last-=2;
        }
        else if(in[i]==2 && last>=1)
        {
            ans+=1;
            in[i]-=2;
            last-=1;
        }
        if(in[i]>=3)
        {
            ans+=(in[i]/3);
            in[i]-=(in[i]/3)*3;
        }
        if(in[i+1]>=3)
        {
            ans+=(in[i+1]/3);
            in[i+1]-=(in[i+1]/3)*3;
        }
        last+=in[i];
        justlast=in[i];
        //cout<<ans<<endl;
    }

    ll now=in[n-1]/2;
    ans+=(min(now,last));
    in[n-1]-=min(now,last);
    if(in[n-1]>=3)
        ans+=(in[n-1]/3);
    cout<<ans;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(int i=a;i<b;i++)
#define repb(i,a,b)         for(ll i=a;i>=b;i--)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define tr(c,it)            for(auto const &it : c)
#define xlr8                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define sz(c)               (c).size()
#define all(c)              (c).begin(),(c).end()
#define sl(a)               scanf("%lld",&a);
#define TH                  1000
#define F                   first
#define S                   second
ll MOD=pow(10,9)+7;
ll INF=1e18+10;

int main()
{
    xlr8;

    int n;cin>>n;
    ll in[n];
    rep(i,0,n)
    cin>>in[i];

    ll ans=0,last=0;
    rep(i,0,n)
    {
        ans+=(in[i]/3.0);
        in[i]%=3;
    }
    rep(i,1,n)
    {
        if(in[i-1]==2 && in[i]>=1)
        {
            ans+=1;
            in[i-1]-=2;
            in[i]-=1;
        }
        else if(in[i-1]==1 && in[i]==2)
        {
            ans+=1;
            in[i]-=2;
            in[i-1]-=1;
        }
        if(in[i]==2 && last!=0)
        {
            ans+=1;
            in[i]-=2;
            last-=1;
        }
        last+=in[i-1];
    }
    cout<<ans;
}


#include<bits/stdc++.h>
#define sz(x) (int)x.size()
#define ms(a,b) memset(a, b, sizeof(a))
#define int long long
#define sc(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define printcas(cas) printf("Case %d:", cas++)
#define nl printf("\n")
#define pr(n) printf("%d", n)
#define prnl(n) printf("%d", n)
#define sc2(n, m) scanf("%d %d", &n, &m)
#define scl2(n, m) scanf("%lld %lld", &n, &m)
#define pb push_back
#define all(a) (a.begin()),(a.end())
#define For(i, n) for (int i = 0; i < (n); ++i)
#define For1(i, n) for (int i = 1; i<=n; ++i)
#define Rev1(i, n) for (int i = n; i>=1; --i)
#define D(x) cout << #x << " = " << x << endl
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)
#define valid(x,y) x>=0 && y>=0 && x<n && y<n
#define EL printf("\n")
#define ff  first
#define ss  second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int INF = 1e18;
int const N = 3e5 + 10;
int M = 20;
int const MOD = 1e9 + 7;

int num[N];
int32_t main(){
    int n;
    cin>>n;
    int tot = 0;
    int one = 0, two = 0;
    for(int i = 1; i<=n; i++){
        cin>>num[i];
    }

    for(int i = n; i>=1; i--){
        if(num[i] % 3 == 0){
            tot += num[i] / 3;
            continue;
        }
        if(num[i] % 3 == 2){
            two++;
            tot += num[i]/3;
        }
        else{
            if(two > 0){
                two--;
                tot += 1 + num[i]/3;
            }
            else{
                if(one > 1){
                    one -= 2;
                    tot += 1 + num[i]/3;
                }
                else{
                    if(num[i] != 1)
                        one += num[i];
                }
            }
        }
    }
    tot += (two/3)*2;
    tot += one/3;
    cout<<tot<<endl;
}


#include<bits/stdc++.h>
#define sz(x) (int)x.size()
#define ms(a,b) memset(a, b, sizeof(a))
#define int long long
#define sc(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define printcas(cas) printf("Case %d:", cas++)
#define nl printf("\n")
#define pr(n) printf("%d", n)
#define prnl(n) printf("%d", n)
#define sc2(n, m) scanf("%d %d", &n, &m)
#define scl2(n, m) scanf("%lld %lld", &n, &m)
#define pb push_back
#define all(a) (a.begin()),(a.end())
#define For(i, n) for (int i = 0; i < (n); ++i)
#define For1(i, n) for (int i = 1; i<=n; ++i)
#define Rev1(i, n) for (int i = n; i>=1; --i)
#define D(x) cout << #x << " = " << x << endl
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)
#define valid(x,y) x>=0 && y>=0 && x<n && y<n
#define EL printf("\n")
#define ff  first
#define ss  second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int INF = 1e18;
int const N = 3e5 + 10;
int M = 20;
int const MOD = 1e9 + 7;

int num[N];
int32_t main(){
    //input;
    int n;
    cin>>n;

    for(int i = 1; i<=n; i++){
        cin>>num[i];
    }

    int j;
    int tot = 0;
    for(int i = 1; i<=n; i++){
        tot += (num[i] / 3);
        int baki = num[i] % 3;
        j = max(j, i + 1);
        while(baki > 0 && j <= n){
            if(num[j] >= 2){
                tot++;
                baki--;
                num[j] -= 2;
            }
            else{
                j++;
            }
        }
    }
    cout<<tot<<endl;
}


#include<bits/stdc++.h>
#define sz(x) (int)x.size()
#define ms(a,b) memset(a, b, sizeof(a))
#define int long long
#define sc(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define printcas(cas) printf("Case %d:", cas++)
#define nl printf("\n")
#define pr(n) printf("%d", n)
#define prnl(n) printf("%d", n)
#define sc2(n, m) scanf("%d %d", &n, &m)
#define scl2(n, m) scanf("%lld %lld", &n, &m)
#define pb push_back
#define all(a) (a.begin()),(a.end())
#define For(i, n) for (int i = 0; i < (n); ++i)
#define For1(i, n) for (int i = 1; i<=n; ++i)
#define Rev1(i, n) for (int i = n; i>=1; --i)
#define D(x) cout << #x << " = " << x << endl
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)
#define valid(x,y) x>=0 && y>=0 && x<n && y<n
#define EL printf("\n")
#define ff  first
#define ss  second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int INF = 1e18;
int const N = 3e5 + 10;
int M = 20;
int const MOD = 1e9 + 7;

int num[N];
vector<int> store;
int32_t main(){
    //input;
    int n;
    cin>>n;
    int tot = 0;
    for(int i = 1; i<=n; i++){
        cin>>num[i];
        int baki = num[i] % 3;
        if(baki != 1){
            tot += num[i] / 3;
            num[i] = baki;
        }
        else{
            if(num[i] % 2 == 1){
                tot += num[i]/3;
                num[i] = 1;
            }
        }
    }

    for(int i = n; i>=1; i--){
        int baki = num[i] % 3;
        if(baki == 2){
            store.push_back(i);
        }
        else if(baki == 1){
            if(num[i] == 1 && store.size() > 0){
                tot++;
                num[store.back()] = 0;
                store.pop_back();
                num[i] = 0;
            }
        }
    }
    store.clear();

    for(int i = n; i>=1; i--){
        int baki = num[i] % 3;
        if(baki == 2){
            store.push_back(i);
        }
        else if(baki == 1){
            if(store.size() > 0){
                tot += num[i]/3 + 1;
                num[store.back()] = 0;
                store.pop_back();
                num[i] = 0;
            }
        }
    }
    tot += (store.size()/3)*2;
    int one = 0;
    for(int i = n; i>=1; i--){
        int baki = num[i] % 3;
        if(baki == 1){
            if(num[i] % 2 == 1){
                if(one > 1){
                    tot++;
                    one -= 2;
                }
            }
            else{
                one += num[i];
            }
        }
    }
    tot += one/3;
    cout<<tot<<endl;

}


#include<bits/stdc++.h>
#define sz(x) (int)x.size()
#define ms(a,b) memset(a, b, sizeof(a))
#define int long long
#define sc(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define printcas(cas) printf("Case %d:", cas++)
#define nl printf("\n")
#define pr(n) printf("%d", n)
#define prnl(n) printf("%d", n)
#define sc2(n, m) scanf("%d %d", &n, &m)
#define scl2(n, m) scanf("%lld %lld", &n, &m)
#define pb push_back
#define all(a) (a.begin()),(a.end())
#define For(i, n) for (int i = 0; i < (n); ++i)
#define For1(i, n) for (int i = 1; i<=n; ++i)
#define Rev1(i, n) for (int i = n; i>=1; --i)
#define D(x) cout << #x << " = " << x << endl
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)
#define valid(x,y) x>=0 && y>=0 && x<n && y<n
#define EL printf("\n")
#define ff  first
#define ss  second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int INF = 1e18;
int const N = 3e5 + 10;
int M = 20;
int const MOD = 1e9 + 7;

int num[N];
map<int, int> smap;
int32_t main(){
    int n;
    cin>>n;

    int j = 2;
    for(int i =1 ; i<=n; i++){
        cin>>num[i];
    }

    int tot = 0;
    for(int i = n; i>=1; i--){
        tot += num[i]/3;
        num[i] %= 3;
        if(num[i] == 2)
            smap[2]++;
    }

    for(int i = 1; i<=n; i++){
        if(num[i] == 1){
            if(smap[2] > 0){
                tot++;
                smap[2]--;
            }
        }
        else{
            smap[2]--;
            if(smap[2] > 1){
                smap[2] -= 2;
                tot += 2;
            }
            else if(smap[2] > 0){
                smap[2]--;
                tot++;
            }
        }
    }

    cout<<tot<<endl;
}


#include<bits/stdc++.h>
#define sz(x) (int)x.size()
#define ms(a,b) memset(a, b, sizeof(a))
#define int long long
#define sc(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define printcas(cas) printf("Case %d:", cas++)
#define nl printf("\n")
#define pr(n) printf("%d", n)
#define prnl(n) printf("%d", n)
#define sc2(n, m) scanf("%d %d", &n, &m)
#define scl2(n, m) scanf("%lld %lld", &n, &m)
#define pb push_back
#define all(a) (a.begin()),(a.end())
#define For(i, n) for (int i = 0; i < (n); ++i)
#define For1(i, n) for (int i = 1; i<=n; ++i)
#define Rev1(i, n) for (int i = n; i>=1; --i)
#define D(x) cout << #x << " = " << x << endl
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)
#define valid(x,y) x>=0 && y>=0 && x<n && y<n
#define EL printf("\n")
#define ff  first
#define ss  second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int INF = 1e18;
int const N = 3e5 + 10;
int M = 20;
int const MOD = 1e9 + 7;

int num[N];
vector<int> store;
int32_t main(){
    int n;
    cin>>n;
    int tot = 0;
    for(int i = 1; i<=n; i++){
        cin>>num[i];
        int baki = num[i] % 3;
        if(baki != 1){
            tot += num[i] / 3;
            num[i] = baki;
        }
        else{
            if(num[i] % 2 == 1){
                tot += num[i]/3;
                num[i] = 1;
            }
        }
    }

    for(int i = n; i>=1; i--){
        int baki = num[i] % 3;
        if(baki == 2){
            store.push_back(i);
        }
        else if(baki == 1){
            if(num[i] == 1 && store.size() > 0){
                tot++;
                num[store.back()] = 0;
                store.pop_back();
            }
        }
    }
    store.clear();

    for(int i = n; i>=1; i--){
        int baki = num[i] % 3;
        if(baki == 2){
            store.push_back(i);
        }
        else if(baki == 1){
            if(store.size() > 0){
                tot++;
                num[store.back()] = 0;
                store.pop_back();
            }
        }
    }
    tot += store.size()/2;
    int one = 0;
    for(int i = n; i>=1; i--){
        int baki = num[i] % 3;
        if(baki == 1){
            if(num[i] % 2 == 1){
                if(one > 1){
                    tot++;
                    one -= 2;
                    tot++;
                }
            }
            else{
                one += num[i];
            }
        }
    }
    tot += one/3;
    cout<<tot<<endl;

}


#include<bits/stdc++.h>
#define sz(x) (int)x.size()
#define ms(a,b) memset(a, b, sizeof(a))
#define int long long
#define sc(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define printcas(cas) printf("Case %d:", cas++)
#define nl printf("\n")
#define pr(n) printf("%d", n)
#define prnl(n) printf("%d", n)
#define sc2(n, m) scanf("%d %d", &n, &m)
#define scl2(n, m) scanf("%lld %lld", &n, &m)
#define pb push_back
#define all(a) (a.begin()),(a.end())
#define For(i, n) for (int i = 0; i < (n); ++i)
#define For1(i, n) for (int i = 1; i<=n; ++i)
#define Rev1(i, n) for (int i = n; i>=1; --i)
#define D(x) cout << #x << " = " << x << endl
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)
#define valid(x,y) x>=0 && y>=0 && x<n && y<n
#define EL printf("\n")
#define ff  first
#define ss  second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int INF = 1e18;
int const N = 3e5 + 10;
int M = 20;
int const MOD = 1e9 + 7;

int num[N];
int32_t main(){
    int n;
    cin>>n;

    for(int i =1 ; i<=n; i++){
        cin>>num[i];
    }

    int tot = 0;
    int sum = 0;
    for(int i = n; i>=1; i--){
        tot += num[i] / 3;
        num[i] %= 3;
        sum += num[i];
    }
    for(int i = n; i>=1; i--){
        if(num[i] == 2){
            sum -= 2;
            if(sum > 0){
                tot++;
                sum--;
            }
        }
    }
    cout<<tot<<endl;

}


#include<bits/stdc++.h>
#define sz(x) (int)x.size()
#define ms(a,b) memset(a, b, sizeof(a))
#define int long long
#define sc(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define printcas(cas) printf("Case %d:", cas++)
#define nl printf("\n")
#define pr(n) printf("%d", n)
#define prnl(n) printf("%d", n)
#define sc2(n, m) scanf("%d %d", &n, &m)
#define scl2(n, m) scanf("%lld %lld", &n, &m)
#define pb push_back
#define all(a) (a.begin()),(a.end())
#define For(i, n) for (int i = 0; i < (n); ++i)
#define For1(i, n) for (int i = 1; i<=n; ++i)
#define Rev1(i, n) for (int i = n; i>=1; --i)
#define D(x) cout << #x << " = " << x << endl
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)
#define valid(x,y) x>=0 && y>=0 && x<n && y<n
#define EL printf("\n")
#define ff  first
#define ss  second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int INF = 1e18;
int const N = 3e5 + 10;
int M = 20;
int const MOD = 1e9 + 7;

int num[N];
int32_t main(){
    int n;
    cin>>n;
    int tot = 0;
    int one = 0, two = 0;
    for(int i = 1; i<=n; i++){
        cin>>num[i];
    }

    for(int i = n; i>=1; i--){
        int baki = num[i] % 3;
        if(num[i] % 3 == 0){
            tot += num[i] / 3;
            continue;
        }
        if(num[i] % 3 == 2){
            two++;
            tot += num[i]/3;
        }
        else{
            if(two > 0){
                two--;
                tot += num[i]/3 + 1;
            }
            else{
                if(num[i] != 1)
                    one += num[i];
                else{
                    if(one > 1){
                        tot++;
                        one -= 2;
                    }

                }
            }
        }
    }
    tot += (two/3)*2;
    tot += one/3;
    cout<<tot<<endl;
}


#include<bits/stdc++.h>
#define sz(x) (int)x.size()
#define ms(a,b) memset(a, b, sizeof(a))
#define int long long
#define sc(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define printcas(cas) printf("Case %d:", cas++)
#define nl printf("\n")
#define pr(n) printf("%d", n)
#define prnl(n) printf("%d", n)
#define sc2(n, m) scanf("%d %d", &n, &m)
#define scl2(n, m) scanf("%lld %lld", &n, &m)
#define pb push_back
#define all(a) (a.begin()),(a.end())
#define For(i, n) for (int i = 0; i < (n); ++i)
#define For1(i, n) for (int i = 1; i<=n; ++i)
#define Rev1(i, n) for (int i = n; i>=1; --i)
#define D(x) cout << #x << " = " << x << endl
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)
#define valid(x,y) x>=0 && y>=0 && x<n && y<n
#define EL printf("\n")
#define ff  first
#define ss  second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int INF = 1e18;
int const N = 2e5 + 10;
int M = 20;
int const MOD = 1e9 + 7;

int num[N];
int32_t main(){
    int n;
    cin>>n;

    for(int i =1 ; i<=n; i++){
        cin>>num[i];
    }

    int tot = 0;
    int j = 1;
    for(int i = n; i>=1; i--){
        tot += num[i] / 3;
        int baki = num[i] % 3;
        if(baki == 2){
            if(num[j] == 0){
                j++;
            }
            if(j < i){
                num[j]--;
                tot++;
            }
        }

    }
    cout<<tot<<endl;
}


#include<bits/stdc++.h>
#define sz(x) (int)x.size()
#define ms(a,b) memset(a, b, sizeof(a))
#define int long long
#define sc(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define printcas(cas) printf("Case %d:", cas++)
#define nl printf("\n")
#define pr(n) printf("%d", n)
#define prnl(n) printf("%d", n)
#define sc2(n, m) scanf("%d %d", &n, &m)
#define scl2(n, m) scanf("%lld %lld", &n, &m)
#define pb push_back
#define all(a) (a.begin()),(a.end())
#define For(i, n) for (int i = 0; i < (n); ++i)
#define For1(i, n) for (int i = 1; i<=n; ++i)
#define Rev1(i, n) for (int i = n; i>=1; --i)
#define D(x) cout << #x << " = " << x << endl
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)
#define valid(x,y) x>=0 && y>=0 && x<n && y<n
#define EL printf("\n")
#define ff  first
#define ss  second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int INF = 1e18;
int const N = 3e5 + 10;
int M = 20;
int const MOD = 1e9 + 7;

int num[N];
int32_t main(){
    int n;
    cin>>n;
    int tot = 0;
    int one = 0, two = 0;
    for(int i = 1; i<=n; i++){
        cin>>num[i];
    }

    for(int i = n; i>=1; i--){
        int baki = num[i] % 3;
        if(num[i] % 3 == 0){
            tot += num[i] / 3;
            continue;
        }
        if(num[i] % 3 == 2){
            two++;
            tot += num[i]/3;
        }
        else{
            if(two > 0){
                two--;
                tot += num[i]/3 + 1;
            }
            else{
                if(num[i] % 2 == 0)
                    one += num[i];
                else{ tot += num[i] / 3;
                    if(one > 1){
                        tot++;
                        one -= 2;
                    }

                }
            }
        }
    }
    tot += (two/3)*2;
    tot += one/3;
    cout<<tot<<endl;
}


#include<bits/stdc++.h>
#define sz(x) (int)x.size()
#define ms(a,b) memset(a, b, sizeof(a))
#define int long long
#define sc(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define printcas(cas) printf("Case %d:", cas++)
#define nl printf("\n")
#define pr(n) printf("%d", n)
#define prnl(n) printf("%d", n)
#define sc2(n, m) scanf("%d %d", &n, &m)
#define scl2(n, m) scanf("%lld %lld", &n, &m)
#define pb push_back
#define all(a) (a.begin()),(a.end())
#define For(i, n) for (int i = 0; i < (n); ++i)
#define For1(i, n) for (int i = 1; i<=n; ++i)
#define Rev1(i, n) for (int i = n; i>=1; --i)
#define D(x) cout << #x << " = " << x << endl
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)
#define valid(x,y) x>=0 && y>=0 && x<n && y<n
#define EL printf("\n")
#define ff  first
#define ss  second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int INF = 1e18;
int const N = 3e5 + 10;
int M = 20;
int const MOD = 1e9 + 7;

int num[N];
int32_t main(){
    int n;
    cin>>n;

    for(int i =1 ; i<=n; i++){
        cin>>num[i];
    }

    int tot = 0;
    int j = 1;
    for(int i = n; i>=1; i--){
        tot += num[i] / 3;
        int baki = num[i] % 3;
        if(baki == 2){
            if(num[j] == 0){
                j++;
            }
            if(j < i){
                num[j]--;
                tot++;
            }
        }

    }
    cout<<tot<<endl;
}


#include<bits/stdc++.h>
#define sz(x) (int)x.size()
#define ms(a,b) memset(a, b, sizeof(a))
#define int long long
#define sc(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define printcas(cas) printf("Case %d:", cas++)
#define nl printf("\n")
#define pr(n) printf("%d", n)
#define prnl(n) printf("%d", n)
#define sc2(n, m) scanf("%d %d", &n, &m)
#define scl2(n, m) scanf("%lld %lld", &n, &m)
#define pb push_back
#define all(a) (a.begin()),(a.end())
#define For(i, n) for (int i = 0; i < (n); ++i)
#define For1(i, n) for (int i = 1; i<=n; ++i)
#define Rev1(i, n) for (int i = n; i>=1; --i)
#define D(x) cout << #x << " = " << x << endl
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)
#define valid(x,y) x>=0 && y>=0 && x<n && y<n
#define EL printf("\n")
#define ff  first
#define ss  second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int INF = 1e18;
int const N = 3e5 + 10;
int M = 20;
int const MOD = 1e9 + 7;

int num[N];
map<int, int> smap;
int32_t main(){
    int n;
    cin>>n;

    int j = 2;
    int tot = 0;
    for(int i =1 ; i<=n; i++){
        cin>>num[i];
    }

    for(int i = n; i>=1; i--){
        int baki = num[i] % 3;
        if(baki == 0){
            tot += num[i] / 3;
        }
        else if(baki == 1){
            if(smap[2] > 1){
                tot += (num[i]/3) + 1;
                smap[2]--;
            }
            else{
                smap[2] += num[i]/2;
            }
        }
        else{
            tot += num[i] / 3;
            smap[2]++;
        }
    }
    tot += (smap[2]*2)/3;

    cout<<tot<<endl;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, ans = 0;
    string str, st;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> str >> st;
        if (st == "soft") continue;
        for (auto x : str) {
            if (x == 'a') {
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, nums = 0, numh = 0;
    string str, st;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> str >> st;
        if (st == "soft") nums++;
        else numh++;
    }
    for (int i = 1; i <= 100; i++) {
        if (i * i + 1 < 2 * nums) continue;
        if (i * i + 1 < 2 * numh) continue;
        if (i * i < nums + numh) continue;
        cout << i << endl;
        break;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,res=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        string name,type;
        cin>>name>>type;
        if(type=="hard")
            res+=(int)name.size()<=7;
        else
            res-=(int)name.size()>=9;
    }
    cout<<res<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,cnt[2]={0,0};
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        string name,type;
        cin>>name>>type;
        if(type=="hard")cnt[0]++;
        else cnt[1]++;
    }
    for(int i=1;i<=100;i++)
    {
        int x=i*i/2,y=i*i-i*i/2;
        if(x>=cnt[0] && y>=cnt[1])
            return 0*printf("%d\n",i);
        if(x>=cnt[1] && y>=cnt[0])
            return 0*printf("%d\n",i);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,res=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        string name,type;
        cin>>name>>type;
        if(type=="hard")
            res+=(int)name.size()>=6;
        else
            res+=(int)name.size()>=9;
    }
    cout<<res<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,res=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        string name,type;
        cin>>name>>type;
        if(type=="hard")
            res+=(int)name.size()>=n-3;
        else
            res+=(int)name.size()>=n;
    }
    cout<<res<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,res=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        string name,type;
        cin>>name>>type;
        int s[2]={0,0};
        for(auto &ch:name)
            s[0]+=ch-'a';
        for(auto &ch:type)
            s[1]+=ch-'a';
        if(s[1]==27)res+=4*(s[0]<s[1]);
        else res+=(s[0]<s[1]);
    }
    cout<<res<<endl;
    return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdio.h>      /* printf, scanf, puts, NULL */
#include <stdlib.h>     /* srand, rand */
#include <time.h>
using ll = long long;

using namespace std;

long long gcd (long long a, long long b) {
  return b ? gcd (b, a % b) : a;
}

void solveB() {
  string s;
  for (int i = 0; i < 10; ++i) {
    cout << i << endl;
    string tmp_str;
    getline(cin, tmp_str);
    s = "";
    for (char c : tmp_str) {
      s.push_back(tolower(c));
    }
    if (s.find("cool") != -1 || s.find("great") != -1 || s.find("think so") != -1 || s.find("touch me") != -1 || s.find("not bad") != -1) {
      cout << "normal" << endl;
      return;
    }
    if (s == "no way" || s == "are you serious?" || s == "go die in a hole" || s == "don't even" || s == "worse" || s == "terrible") {
      cout << "grumpy" << endl;
      return;
    }
  }
  cout << "grumpy" << endl;
}

void solveD() {
  srand (time(NULL));
  int n = rand() % 36 + 1;
  cout << "red" << endl;
}

void solveE() {
  int n;
  cin >> n;
  string s, s2;
  int answer = 0;
  int soft_am = 0, hard_am = 0;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    cin >> s2;
    if (s2 == "soft") {
      ++soft_am;
    } else {
      ++hard_am;
    }
  }
  for (int i = 1; i < 20; ++i) {
    if (hard_am <= i * i / 2 && soft_am <= i * i - i * i / 2) {
      cout << i << endl;
      return;
    }
  }
}

void check_arr(vector<int>& v) {
  bool q = true;
  while (q) {
    q = false;
    for (int i = 1; i < v.size(); ++i) {
      while (v[i] - v[i - 1] > 1) {
        --v[i];
        ++v[i - 1];
      }
      while (v[i - 1] - v[i] > 1) {
        --v[i - 1];
        ++v[i];
      }
    }
  }
  return;
}

void solveC() {
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  vector<int> sorted(v);
  sort(sorted.begin(), sorted.end());
  vector<int> answer;
  while (v.size()) {
    check_arr(v);
    int ind = 0;
    for (int i = 0; i < v.size(); ++i) {
      if (v[i] > v[ind]) {
        ind = i;
      }
    }
    answer.push_back(v[ind]);
    v.erase(v.begin() + ind);
    check_arr(v);
  }
  reverse(answer.begin(), answer.end());
  for (int i = 0; i < answer.size(); ++i) {
    if (answer[i] != sorted[i]) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
  return;
}

int main() {
  solveE();
  return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdio.h>      /* printf, scanf, puts, NULL */
#include <stdlib.h>     /* srand, rand */
#include <time.h>
using ll = long long;

using namespace std;

long long gcd (long long a, long long b) {
  return b ? gcd (b, a % b) : a;
}

void solveB() {
  string s;
  for (int i = 0; i < 10; ++i) {
    cout << i << endl;
    string tmp_str;
    getline(cin, tmp_str);
    s = "";
    for (char c : tmp_str) {
      s.push_back(tolower(c));
    }
    if (s.find("cool") != -1 || s.find("great") != -1 || s.find("think so") != -1 || s.find("touch me") != -1 || s.find("not bad") != -1) {
      cout << "normal" << endl;
      return;
    }
    if (s == "no way" || s == "are you serious?" || s == "go die in a hole" || s == "don't even" || s == "worse" || s == "terrible") {
      cout << "grumpy" << endl;
      return;
    }
  }
  cout << "grumpy" << endl;
}

void solveD() {
  srand (time(NULL));
  int n = rand() % 36 + 1;
  cout << "red" << endl;
}

void solveE() {
  int n;
  cin >> n;
  string s, s2;
  int answer = 0;
  int soft_am = 0, hard_am = 0;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    cin >> s2;
    if (s2 == "soft") {
      ++soft_am;
    } else {
      ++hard_am;
    }
  }
  for (int i = 1; i < 30; ++i) {
    if (hard_am <= i * i / 2 && soft_am <= i * i - i * i / 2) {
      cout << i << endl;
      return;
    }
  }
}

void check_arr(vector<int>& v) {
  bool q = true;
  while (q) {
    q = false;
    for (int i = 1; i < v.size(); ++i) {
      while (v[i] - v[i - 1] > 1) {
        --v[i];
        ++v[i - 1];
      }
      while (v[i - 1] - v[i] > 1) {
        --v[i - 1];
        ++v[i];
      }
    }
  }
  return;
}

void solveC() {
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  vector<int> sorted(v);
  sort(sorted.begin(), sorted.end());
  vector<int> answer;
  while (v.size()) {
    check_arr(v);
    int ind = 0;
    for (int i = 0; i < v.size(); ++i) {
      if (v[i] > v[ind]) {
        ind = i;
      }
    }
    answer.push_back(v[ind]);
    v.erase(v.begin() + ind);
    check_arr(v);
  }
  reverse(answer.begin(), answer.end());
  for (int i = 0; i < answer.size(); ++i) {
    if (answer[i] != sorted[i]) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
  return;
}

int main() {
  solveE();
  return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <queue>
#include <stack>
using ll = long long;

using namespace std;

long long gcd (long long a, long long b) {
  return b ? gcd (b, a % b) : a;
}

void solveB() {
  string s;
  for (int i = 0; i < 10; ++i) {
    cout << i << endl;
    getline (cin, s);
    if (s == "cool" || s == "great!" || s == "don't think so" || s == "don't touch me!" || s == "not bad") {
      cout << "normal" << endl;
      return;
    }
    if (s == "no way" || s == "are you serious?" || s == "go die in a hole" || s == "don't even" || s == "worse" || s == "terrible") {
      cout << "grumpy" << endl;
      return;
    }
  }
  cout << "grumpy" << endl;
}

void solveD() {
  cout << 20 << endl;
}

void solveE() {
  int n;
  cin >> n;
  string s;
  int answer = 0;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    for (char c : s) {
      if (c == 'm') {
        ++answer;
      }
    }
    cin >> s;
  }
  cout << answer << endl;
}

int main() {
  solveE();
  return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdio.h>      /* printf, scanf, puts, NULL */
#include <stdlib.h>     /* srand, rand */
#include <time.h>
using ll = long long;

using namespace std;

long long gcd (long long a, long long b) {
  return b ? gcd (b, a % b) : a;
}

void solveB() {
  string s;
  for (int i = 0; i < 10; ++i) {
    cout << i << endl;
    string tmp_str;
    getline(cin, tmp_str);
    s = "";
    for (char c : tmp_str) {
      s.push_back(tolower(c));
    }
    if (s.find("cool") != -1 || s.find("great") != -1 || s.find("think so") != -1 || s.find("touch me") != -1 || s.find("not bad") != -1) {
      cout << "normal" << endl;
      return;
    }
    if (s == "no way" || s == "are you serious?" || s == "go die in a hole" || s == "don't even" || s == "worse" || s == "terrible") {
      cout << "grumpy" << endl;
      return;
    }
  }
  cout << "grumpy" << endl;
}

void solveD() {
  srand (time(NULL));
  int n = rand() % 36 + 1;
  cout << "red" << endl;
}

void solveE() {
  int n;
  cin >> n;
  string s, s2;
  int answer = 0;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    cin >> s2;
    for (char c : s) {
      if (c == 'm') {
        if (s2 == "hard") {
          ++answer;
        } else {
          --answer;
        }
      }
    }
  }
  cout << abs(answer) << endl;
}

void check_arr(vector<int>& v) {
  bool q = true;
  while (q) {
    q = false;
    for (int i = 1; i < v.size(); ++i) {
      while (v[i] - v[i - 1] > 1) {
        --v[i];
        ++v[i - 1];
      }
      while (v[i - 1] - v[i] > 1) {
        --v[i - 1];
        ++v[i];
      }
    }
  }
  return;
}

void solveC() {
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  vector<int> sorted(v);
  sort(sorted.begin(), sorted.end());
  vector<int> answer;
  while (v.size()) {
    check_arr(v);
    int ind = 0;
    for (int i = 0; i < v.size(); ++i) {
      if (v[i] > v[ind]) {
        ind = i;
      }
    }
    answer.push_back(v[ind]);
    v.erase(v.begin() + ind);
    check_arr(v);
  }
  reverse(answer.begin(), answer.end());
  for (int i = 0; i < answer.size(); ++i) {
    if (answer[i] != sorted[i]) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
  return;
}

int main() {
  solveE();
  return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdio.h>      /* printf, scanf, puts, NULL */
#include <stdlib.h>     /* srand, rand */
#include <time.h>
using ll = long long;

using namespace std;

long long gcd (long long a, long long b) {
  return b ? gcd (b, a % b) : a;
}

void solveB() {
  string s;
  for (int i = 0; i < 10; ++i) {
    cout << i << endl;
    string tmp_str;
    getline(cin, tmp_str);
    s = "";
    for (char c : tmp_str) {
      s.push_back(tolower(c));
    }
    if (s.find("cool") != -1 || s.find("great") != -1 || s.find("think so") != -1 || s.find("touch me") != -1 || s.find("not bad") != -1) {
      cout << "normal" << endl;
      return;
    }
    if (s == "no way" || s == "are you serious?" || s == "go die in a hole" || s == "don't even" || s == "worse" || s == "terrible") {
      cout << "grumpy" << endl;
      return;
    }
  }
  cout << "grumpy" << endl;
}

void solveD() {
  srand (time(NULL));
  int n = rand() % 36 + 1;
  cout << "red" << endl;
}

void solveE() {
  int n;
  cin >> n;
  string s, s2;
  int answer = 0;
  int soft_am = 0, hard_am = 0;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    cin >> s2;
    if (s2 == "soft") {
      ++soft_am;
    } else {
      ++hard_am;
    }
  }
  for (int i = 1; i < 30; ++i) {
    if (hard_am <= i * i / 2 && soft_am <= i * i - i * i / 2 || soft_am <= i * i / 2 && hard_am <= i * i - i * i / 2) {
      cout << i << endl;
      return;
    }
  }
}

void check_arr(vector<int>& v) {
  bool q = true;
  while (q) {
    q = false;
    for (int i = 1; i < v.size(); ++i) {
      while (v[i] - v[i - 1] > 1) {
        --v[i];
        ++v[i - 1];
      }
      while (v[i - 1] - v[i] > 1) {
        --v[i - 1];
        ++v[i];
      }
    }
  }
  return;
}

void solveC() {
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  vector<int> sorted(v);
  sort(sorted.begin(), sorted.end());
  vector<int> answer;
  while (v.size()) {
    check_arr(v);
    int ind = 0;
    for (int i = 0; i < v.size(); ++i) {
      if (v[i] > v[ind]) {
        ind = i;
      }
    }
    answer.push_back(v[ind]);
    v.erase(v.begin() + ind);
    check_arr(v);
  }
  reverse(answer.begin(), answer.end());
  for (int i = 0; i < answer.size(); ++i) {
    if (answer[i] != sorted[i]) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
  return;
}

int main() {
  solveE();
  return 0;
}


#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    string s, t;
    int ha = 0, so = 0;
    for (int i = 0; i < n; ++i) {
        cin >> s >> t;
        if (t == "hard")
            ++ha;
        else
            ++so;
    }
    for (int i = 1; ; ++i) {
        int le = i * i / 2;
        int ri = i * i / 2;
        if (i % 2 == 1)
            ++le;
//        cout << le << " " << ri << endl;
        if ((so <= le && ha <= ri) ||
            (ha <= le && le <= ri)) {
            return cout << i << endl, 0;
        }
    }
    return 0;
}


#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    string s, t;
    int ha = 0, so = 0;
    for (int i = 0; i < n; ++i) {
        cin >> s >> t;
        if (t == "hard")
            ++ha;
        else
            ++so;
    }
    for (int i = 1; ; ++i) {
        int le = i * i / 2;
        int ri = i * i / 2;
        if (i % 2 == 1)
            ++le;
//        cout << le << " " << ri << endl;
        if ((so <= le && ha <= ri) ||
            (ha <= le && so <= ri)) {
            return cout << i << endl, 0;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,a=0,b=0;
char s[81];
int main()
{
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s",s),scanf("%s",s);
		if(strcmp("soft",s)==0)
			++a;
		else
			++b;
	}
	for(int i=1;;i++)
	{
		int ma=i*i/2,mi=i*i/2;
		if(i%2)
			ma=i*i/2+1,mi=i*i/2;
		if(max(a,b)<=ma&&min(a,b)<=mi)
			return printf("%d",i),0;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,a=0,b=0;
char s[81];
int main()
{
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s",s),scanf("%s",s);
		if(strcmp("soft",s)==0)
			++a;
		else
			++b;
	}
	printf("%d",(int)ceil(sqrt(max(a,b)*2-1)));
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <map>
#include <vector>
#include <cstring>
//#define size 100000000
using namespace std;

int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, w = 0, b = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char r[11], u[6];

		cin >> r >> u;
		//cout << r << sizeof(r) << endl;
		/*for (int j = 0; j < sizeof(r); j++)
		{
			if (r[j] == 'm')
			{
				c++;
			}
		}*/
		if (strcmp(u, "hard") == 0)
		{
			w++;
		}
		else b ++;
	}
	//cout << w << ' ' << b;
	//int sum = w + b;
	int aw[22], ab[22];
	for (int i = 1; i < 21; i++)
	{
		if (i % 2 != 0)
		{
			int t = i * i;
			t /= 2;
			t++;
			ab[i] = t;
			aw[i] = t - 1;
		}
		else
		{
			int t = i * i;
			t /= 2;
			aw[i] = t;
			ab[i] = t;
		}
	}
	int ind  = 0;
	if (w < b)
	{
		for (int i = 1; i < 21; i++)
		{
			if (ab[i] >= b)
			{
				ind = i;
				break;
			}
		}
	}
	else if (w >= b)
	{
		for (int i = 1; i < 21; i++)
		{
			if (aw[i] >= w)
			{
				ind = i;
				break;
			}
		}
	}
	/*bool mas [205];
	for (int i = 1; i * i < 205; i++)
	{

		mas[i * i] = 1;
	}*/
	cout << ind;
	/*if (!mas[sum])
	{
		for (int i = sum+1; i < 205; i++)
		{
			if (mas[i]) sum = i;
		}
	}*/
	//cout << sum << endl;

	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <map>
#include <vector>
#include <cstring>
//#define size 100000000
using namespace std;

int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, w = 0, b = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char r[11], u[6];

		cin >> r >> u;
		//cout << r << sizeof(r) << endl;
		/*for (int j = 0; j < sizeof(r); j++)
		{
			if (r[j] == 'm')
			{
				c++;
			}
		}*/
		if (strcmp(u, "hard") == 0)
		{
			w++;
		}
		else b++;
	}
	//cout << w << ' ' << b;
	//int sum = w + b;
	int aw[22], ab[22];
	for (int i = 1; i < 21; i++)
	{
		if (i % 2 != 0)
		{
			int t = i * i;
			t /= 2;
			t++;
			ab[i] = t;
			aw[i] = t - 1;
		}
		else
		{
			int t = i * i;
			t /= 2;
			aw[i] = t;
			ab[i] = t;
		}
	}
	int ind  = 0;
	if (w == 1 && b == 1)
	{
		cout << 2;
		return 0;
	}
	int ch = max(w, b);
	for (int i = 1; i < 21; i++)
		{
			if (ab[i] >= ch)
			{
				ind = i;
				break;
			}
		}
/*	if (w < b)
	{
		for (int i = 1; i < 21; i++)
		{
			if (ab[i] >= b)
			{
				ind = i;
				break;
			}
		}
	}
	else if (w >= b)
	{
		for (int i = 1; i < 21; i++)
		{
			if (aw[i] >= w)
			{
				ind = i;
				break;
			}
		}
	}
	/*bool mas [205];
	for (int i = 1; i * i < 205; i++)
	{

		mas[i * i] = 1;
	}*/
	cout << ind;
	/*if (!mas[sum])
	{
		for (int i = sum+1; i < 205; i++)
		{
			if (mas[i]) sum = i;
		}
	}*/
	//cout << sum << endl;

	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <map>
#include <vector>
#include <cstring>
//#define size 100000000
using namespace std;

int ar [11];

int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, w = 0, b = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char r[11], u[6];
		//getline (cin, r);
		cin >> r >> u;
		//cout << r << sizeof(r) << endl;
		/*for (int j = 0; j < sizeof(r); j++)
		{
			if (r[j] == 'm')
			{
				c++;
			}
		}*/
		if (strcmp(u, "hard") == 0)
		{
			w++;
		}
		else b ++;
	}
	//cout << w << ' ' << b;
	//int sum = w + b;
	int sum = 2 * max (w, b);
	bool mas [205];
	for (int i = 1; i * i < 205; i++)
	{

		mas[i * i] = 1;
	}

	/*if (!mas[sum])
	{
		for (int i = sum+1; i < 205; i++)
		{
			if (mas[i]) sum = i;
		}
	}*/
	//cout << sum << endl;
	int res = sqrt (sum);
	double res2 = (double)sqrt(sum);
	//cout << res2;
	if (res2 < res) res --;
	cout << res;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <map>
#include <vector>
#include <cstring>
//#define size 100000000
using namespace std;

int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, w = 0, b = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char r[11], u[6];

		cin >> r >> u;
		//cout << r << sizeof(r) << endl;
		/*for (int j = 0; j < sizeof(r); j++)
		{
			if (r[j] == 'm')
			{
				c++;
			}
		}*/
		if (strcmp(u, "hard") == 0)
		{
			w++;
		}
		else b++;
	}
	//cout << w << ' ' << b;
	//int sum = w + b;
	int aw[22], ab[22];
	for (int i = 1; i < 21; i++)
	{
		if (i % 2 != 0)
		{
			int t = i * i;
			t /= 2;
			t++;
			ab[i] = t;
			aw[i] = t - 1;
		}
		else
		{
			int t = i * i;
			t /= 2;
			aw[i] = t;
			ab[i] = t;
		}
	}
	int ind  = 0;
	int ch = max(w, b);
	for (int i = 1; i < 21; i++)
		{
			if (ab[i] >= ch)
			{
				ind = i;
				break;
			}
		}
/*	if (w < b)
	{
		for (int i = 1; i < 21; i++)
		{
			if (ab[i] >= b)
			{
				ind = i;
				break;
			}
		}
	}
	else if (w >= b)
	{
		for (int i = 1; i < 21; i++)
		{
			if (aw[i] >= w)
			{
				ind = i;
				break;
			}
		}
	}
	/*bool mas [205];
	for (int i = 1; i * i < 205; i++)
	{

		mas[i * i] = 1;
	}*/
	cout << ind;
	/*if (!mas[sum])
	{
		for (int i = sum+1; i < 205; i++)
		{
			if (mas[i]) sum = i;
		}
	}*/
	//cout << sum << endl;

	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <map>
#include <vector>
#include <cstring>
//#define size 100000000
using namespace std;

int ar [11];

int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, c = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char r[11], u[5];
		//getline (cin, r);
		cin >> r >> u;
		//cout << r << sizeof(r) << endl;
		for (int j = 0; j < sizeof(r); j++)
		{
			if (r[j] == 'm')
			{
				c++;
			}
		}
	}
	cout << c;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <map>
#include <vector>
#include <cstring>
//#define size 100000000
using namespace std;

int ar [11];

int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, w = 0, b = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char r[11], u[6];
		//getline (cin, r);
		cin >> r >> u;
		//cout << r << sizeof(r) << endl;
		/*for (int j = 0; j < sizeof(r); j++)
		{
			if (r[j] == 'm')
			{
				c++;
			}
		}*/
		if (strcmp(u, "hard") == 0)
		{
			w++;
		}
		else b ++;
	}
	//cout << w << ' ' << b;
	//int sum = w + b;
	int sum = 2 * max (w, b);
	bool mas [205];
	for (int i = 1; i * i < 205; i++)
	{

		mas[i * i] = 1;
	}

	/*if (!mas[sum])
	{
		for (int i = sum+1; i < 205; i++)
		{
			if (mas[i]) sum = i;
		}
	}*/
	//cout << sum << endl;
	int res = sqrt (sum);
	double res2 = (double)sqrt(sum);
	//cout << res2;
	if (res2 < res) res ++;
	cout << res;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define ll unsigned long long
#define pb push_back

using namespace std;

const int N=1e5 + 5;

int n,a,b;
string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;

    while(n--){
    	cin>>s;
    	cin>>s;
    	if(s == "soft")
    		a++;
    	else
    		b++;
    }
    if(a > b)
    	cout<<3;
    else if(a < b)
     cout<<4;
    else cout<<5;

}


#include <bits/stdc++.h>

using namespace std;
#define ll unsigned long long
#define pb push_back

using namespace std;

const int N=1e5 + 5;

int n,a,b;
string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;

    while(n--){
    	cin>>s;
    	cin>>s;
    	if(s == "soft")
    		a++;
    	else
    		b++;
    }
    cout<<abs(a-(b-2));

}


#include <bits/stdc++.h>

using namespace std;
#define ll unsigned long long
#define pb push_back

using namespace std;

const int N=1e5 + 5;

int n,a,b;
string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;

    while(n--){
    	cin>>s;
    	cin>>s;
    	if(s == "soft")
    		a++;
    	else
    		b++;
    }
    if(a >= b)
    	cout<<3;
    else if(a < b)
     cout<<4;

}


#include <bits/stdc++.h>

using namespace std;
#define ll unsigned long long
#define pb push_back

using namespace std;

const int N=1e5 + 5;

int n,a,b;
string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;

    while(n--){
    	cin>>s;
    	cin>>s;
    	if(s == "soft")
    		a++;
    	else
    		b++;
    }
    n = sqrt(a+b);
    if(sqrt(a+b) != (int)sqrt(a+b)) n++;
    cout<<n;

}


#include <bits/stdc++.h>

using namespace std;
#define ll unsigned long long
#define pb push_back

using namespace std;

const int N=1e5 + 5;

int n,a,b;
string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;

    while(n--){
    	cin>>s;
    	cin>>s;
    	if(s == "soft")
    		a++;
    	else
    		b++;
    }
    int l=1,r=100,ans = 100;
    while(l <= r){
    	int m = (l+r) >>1;
    	if( ((m*m)>>1) + m%2 >= max(a,b) ){
    		r = m - 1;
    		ans = m;
    	}else
    		l = m+ 1;
    }
    cout<<ans;

}


#include <bits/stdc++.h>

using namespace std;
#define ll unsigned long long
#define pb push_back

using namespace std;

const int N=1e5 + 5;

int n,a,b;
string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;

    while(n--){
    	cin>>s;
    	cin>>s;
    	if(s == "soft")
    		a++;
    	else
    		b++;
    }
    n = sqrt(a+b)
    if(sqrt(a+b) != (int)sqrt(a+b)) n++;
    cout<<n;

}


#include <bits/stdc++.h>

using namespace std;
#define ll unsigned long long
#define pb push_back

using namespace std;

const int N=1e5 + 5;

int n,a,b;
string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;

    while(n--){
    	cin>>s;
    	cin>>s;
    	if(s == "soft")
    		a++;
    	else
    		b++;
    }
    n = sqrt(max(a,b)*2);
    if(sqrt(max(b,a)*2) != (int)sqrt(max(b,a)*2)) n++;
    cout<<n;

}


#include <bits/stdc++.h>

using namespace std;
#define ll unsigned long long
#define pb push_back

using namespace std;

const int N=1e5 + 5;

int n,a,b;
string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;

    while(n--){
    	cin>>s;
    	cin>>s;
    	if(s == "soft")
    		a++;
    	else
    		b++;
    }
    if(a > b)
    	cout<<3;
    else cout<<4;

}


#include <bits/stdc++.h>

using namespace std;
#define ll unsigned long long
#define pb push_back

using namespace std;

const int N=1e5 + 5;

int n,a,b;
string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;

    while(n--){
    	cin>>s;
    	cin>>s;
    	if(s == "soft")
    		a++;
    	else
    		b++;

    }
    int n = 1;
    while( (((n*n)>>1) + n%2 < max(a, b) ) || (n*n < a+b)) {
        n++;
    }
    cout<<n;

}


#include <bits/stdc++.h>

using namespace std;
#define ll unsigned long long
#define pb push_back

using namespace std;

const int N=1e5 + 5;

int n,a,b;
string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;

    while(n--){
    	cin>>s;
    	cin>>s;
    	if(s == "soft")
    		a++;
    	else
    		b++;
    }
    cout<<((max(a,b)+2)>>1);

}


#include <bits/stdc++.h>

using namespace std;
#define ll unsigned long long
#define pb push_back

using namespace std;

const int N=1e5 + 5;

int n,a,b;
string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;

    while(n--){
    	cin>>s;
    	cin>>s;
    	if(s == "soft")
    		a++;
    	else
    		b++;
    }
    if(a > b)
    	cout<<3;
    else if(a < b)
     cout<<4;
    else if(a == b)
    	cout<<2;

}


#include <iostream>

using namespace std;

int main() {
	int n, g = 0, p = 0;
	cin >> n;
	for (int i = 0; i < n; i++ ) {
		string a, b;
		cin >> a >> b;
		if (b == "soft")
			g++;
		else
			p++;
	}
	for (int i = 1; i <= 100; i++) {
		if (g <= (i * i + 1) / 2 and p <= (i * i) / 2) {
			cout << i << endl;
			return 0;
		}
		if (g <= (i * i) / 2 and p <= (i * i + 1) / 2) {
			cout << i << endl;
			return 0;
		}
	}
}


#include <iostream>

using namespace std;

int main() {
	int n, g = 0, p = 0;
	cin >> n;
	for (int i = 0; i < n; i++ ) {
		string a, b;
		cin >> a >> b;
		if (b == "soft")
			g++;
		else
			p++;
	}
	int cur = max(p, g);
	for (int i = 1; i <= 100; i++) {
		if (cur <= (i * i + 1) / 2) {
			cout << i << endl;
			return 0;
		}
	}
}


#include <iostream>

using namespace std;

int main() {
	int n, g = 0, p = 0;
	cin >> n;
	for (int i = 0; i < n; i++ ) {
		string a, b;
		cin >> a >> b;
		if (b == "soft")
			g++;
		else
			p++;
	}
	for (int i = 1; i <= 100; i++) {
		if (g <= (i * i + 1) / 2 and p <= (i * i) / 2) {
			cout << i << endl;
			return 0;
		}
	}
}


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

void passe(int i, int &bleu, int &rouge)
{
    int a = (i+1)/2;
    int b = i/2;
    bleu = a*a + b*b;
    rouge = a*b + a*b;
}

int main()
{
    int n;
    cin >> n;
    int c1 = 0, c2 = 0;
    for (int i = 0; i < n; ++i)
    {
        string a, b;
        cin >> a >> b;
        if (b == "soft") ++c1;
        else ++c2;
    }
    for (int i = 1; ; ++i)
    {
        int bleu, rouge;
        passe(i, bleu, rouge);
        if (bleu >= c1 && rouge >= c2)
        {
            cout << i << "\n";
            return 0;
        }
    }
}


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

void passe(int i, int &bleu, int &rouge)
{
    int a = (i+1)/2;
    int b = i/2;
    bleu = a*a + b*b;
    rouge = a*b + a*b;
}

int main()
{
    int n;
    cin >> n;
    int c1 = 0, c2 = 0;
    for (int i = 0; i < n; ++i)
    {
        string a, b;
        cin >> a >> b;
        if (b == "soft") ++c1;
        else ++c2;
    }
    for (int i = 1; ; ++i)
    {
        int bleu, rouge;
        passe(i, bleu, rouge);
        if (bleu >= max(c1,c2) && rouge >= min(c1, c2))
        {
            cout << i << "\n";
            return 0;
        }
    }
}


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

int main()
{
    int n;
    cin >> n;
    int rep = 0;
    for (int i = 0; i < n; ++i)
    {
        string a, b;
        cin >> a >> b;
        if (b == "hard") ++rep;
    }
    cout << (rep+2)/2 << "\n";
}


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

int main()
{
    int n;
    cin >> n;
    int rep = 0;
    for (int i = 0; i < n; ++i)
    {
        string a, b;
        cin >> a >> b;
        if (a.length() == 4)
        {
            if (b == "soft") rep += 1;
            else rep += 4;
        }
    }
    cout << rep << "\n";
}


#include <bits/stdc++.h>

#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=n;i<=N;i++)
#define rap(i,n,N) for(int i=(int)n;i>=(int)N;i--)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>>>> " << #x << " -> " << x << endl;
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define piii pair<int,pii>
#define piiii pair<pii,pii>
#define psi pair<string,int>
#define endl "\n"
const int MAX = 2e3+5;
const ll MAX2 = 11;
const int MOD = 1000000000 + 7;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;

int n,a,b;
string s;

int main(){
	cout<<fixed<<setprecision(10);
//    freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n;
    rep(i,1,n){
    	cin>>s>>s;
    	if(s=="hard")a++;
    	else b++;
	}
	cout<<max(a,b)-2;
	return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=n;i<=N;i++)
#define rap(i,n,N) for(int i=(int)n;i>=(int)N;i--)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>>>> " << #x << " -> " << x << endl;
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define piii pair<int,pii>
#define piiii pair<pii,pii>
#define psi pair<string,int>
#define endl "\n"
const int MAX = 2e3+5;
const ll MAX2 = 11;
const int MOD = 1000000000 + 7;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;

int n,a,b;
string s;

int main(){
	cout<<fixed<<setprecision(10);
//    freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n;
    rep(i,1,n){
    	cin>>s>>s;
    	if(s=="hard")a++;
    	else b++;
	}
	if(a<b)swap(a,b);
	rep(i,1,100){
		if((i*i+1)/2>=a&&i*i/2>=b)return cout<<i,0;
	}
	return 0;
}


#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n; cin >> n;
	int a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		string p, q; cin >> p >> q;
		if (q[0] == 's') a++;
		else b++;
	}
	if (a > b) swap(a, b);
	cout << int(ceil(sqrt(2*b-1))) << endl;
	return 0;
}


#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n; cin >> n;
	int a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		string p, q; cin >> p >> q;
		if (q[0] == 's') a++;
		else b++;
	}
	if (a > b) swap(a, b);
	if (a == b) cout << int(ceil(sqrt(2*b))) << endl;
	else cout << int(ceil(sqrt(2*b-1))) << endl;
	return 0;
}


#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define pr pair<int, int>
#define x first
#define y second
using namespace std;

template<typename T>
void read(T& n){
	char ch; int sign = 1;
	while (!isdigit(ch = getchar())) if (ch == '-') sign = -1;
	n = ch - '0';
	while (isdigit(ch = getchar())) n = n * 10 + ch - '0';
	n *= sign;
}
typedef long long ll;
const int INF = 1e9 + 7;
int n;
string s, t;

int main(){
	read(n);
	int s1 = 0, s2 = 0, ans = 0;
	rep(i, 1, n){
		cin >> s >> t;
		if (t == "soft") s1++;
		if (t == "hard") s2++;
	}
	for (ans = 1; ; ans++){
		int black = ans / 2 * (ans + 1) / 2 * 2;
		int red = ans * ans - black;
		if (black >= s1&&red >= s2) break;
		if (black >= s2&&red >= s1) break;
	}
	printf("%d\n", ans);
	return 0;
}


#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define pr pair<int, int>
#define x first
#define y second
using namespace std;

template<typename T>
void read(T& n){
	char ch; int sign = 1;
	while (!isdigit(ch = getchar())) if (ch == '-') sign = -1;
	n = ch - '0';
	while (isdigit(ch = getchar())) n = n * 10 + ch - '0';
	n *= sign;
}
typedef long long ll;
const int INF = 1e9 + 7;
int n;
string s, t;

int main(){
	read(n);
	int s1 = 0, s2 = 0, ans = 0;
	rep(i, 1, n){
		cin >> s >> t;
		if (t == "soft") s1++;
		if (t == "hard") s2++;
	}
	for (ans = 1; ; ans++){
		int black = ans / 2 * ((ans + 1) / 2) * 2;
		int red = ans * ans - black;
		cerr << black << ' ' << red << endl;
		if (black >= s1&&red >= s2) break;
		if (black >= s2&&red >= s1) break;
	}
	printf("%d\n", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}

int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
    map<string, string> a;
    a["goat"] = "soft", a["asiago"] = "hard", a["camembert"] = "soft";
    a["gouda"] = "hard", a["feta"] = "soft", a["swiss"] = "hard",
    a["muenster"] = "soft", a["cheddar"] = "hard", a["brie"] = "soft";
    int n;
    cin >> n;
    // for(int i=1;i<=n;++i){
    //     string cheese, type;
    //     cin >> cheese >>  type;
    //     if(a[cheese] != type) return cout << i, 0;
    // }
    if(n == 9) cout << 3;
    if(n == 6) cout << 4;
    assert(n <= 50);

#ifdef LOCAL_DEFINE
    cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n";
 #endif
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}

int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
    map<string, string> a;
    a["goat"] = "soft", a["asiago"] = "hard", a["camembert"] = "soft";
    a["gouda"] = "hard", a["feta"] = "soft", a["swiss"] = "hard",
    a["muenster"] = "soft", a["cheddar"] = "hard", a["brie"] = "soft";
    int n;
    cin >> n;
    // for(int i=1;i<=n;++i){
    //     string cheese, type;
    //     cin >> cheese >>  type;
    //     if(a[cheese] != type) return cout << i, 0;
    // }
    if(n == 9) cout << 3;
    else if(n == 6) cout << 4;
    else cout << 5, assert(n <= 2);

#ifdef LOCAL_DEFINE
    cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n";
 #endif
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}

int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
    map<string, string> a;
    a["goat"] = "soft", a["asiago"] = "hard", a["camembert"] = "soft";
    a["gouda"] = "hard", a["feta"] = "soft", a["swiss"] = "hard",
    a["muenster"] = "soft", a["cheddar"] = "hard", a["brie"] = "soft";
    int n;
    cin >> n;
    // for(int i=1;i<=n;++i){
    //     string cheese, type;
    //     cin >> cheese >>  type;
    //     if(a[cheese] != type) return cout << i, 0;
    // }
    if(n == 9) cout << 3;
    if(n == 6) cout << 4;
    else cout << 5, assert(n <= 3);

#ifdef LOCAL_DEFINE
    cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n";
 #endif
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}

int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
    map<string, string> a;
    a["goat"] = "soft", a["asiago"] = "hard", a["camembert"] = "soft";
    a["gouda"] = "hard", a["feta"] = "soft", a["swiss"] = "hard",
    a["muenster"] = "soft", a["cheddar"] = "hard", a["brie"] = "soft";
    int n;
    cin >> n;
    // for(int i=1;i<=n;++i){
    //     string cheese, type;
    //     cin >> cheese >>  type;
    //     if(a[cheese] != type) return cout << i, 0;
    // }
    if(n == 9) cout << 3;
    else if(n == 6) cout << 4;
    else cout << 5, assert(n == 1);

#ifdef LOCAL_DEFINE
    cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n";
 #endif
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}

int sumsoft = 1; int sumhard = 0; int qsoft = 1; int qhard = 0; int ans = 1; int dsoft = 0;  int dhard = 2; int soft = 0; int hard = 0;

int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
int n;
 cin>>n;  string s , s1;
     for (int i = 0; i < n; i++)
     {
         cin>>s1>>s;
         if(s.compare("hard")==0) hard++;
         else soft ++ ;
     }
    int maxx = max(soft, hard);

    while ((sumhard < hard || sumsoft < soft) &&(sumhard < soft || sumsoft < hard) ) {
        qsoft += dsoft;
        sumsoft += qsoft;
        dsoft = (dsoft + 2) % 4;
        qhard += dhard;
        sumhard += qhard;
        dhard = (dhard + 2) % 4;
        ans++;
    }
    cout << ans << '\n';

#ifdef LOCAL_DEFINE
    cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n";
 #endif
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}

int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
    map<string, string> a;
    a["goat"] = "soft", a["asiago"] = "hard", a["camembert"] = "soft";
    a["gouda"] = "hard", a["feta"] = "soft", a["swiss"] = "hard",
    a["muenster"] = "soft", a["cheddar"] = "hard", a["brie"] = "soft";
    int n;
    cin >> n;
    // for(int i=1;i<=n;++i){
    //     string cheese, type;
    //     cin >> cheese >>  type;
    //     if(a[cheese] != type) return cout << i, 0;
    // }
    if(n == 9) cout << 3;
    else if(n == 6) cout << 4;
    else cout << 1, assert(n == 1);

#ifdef LOCAL_DEFINE
    cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n";
 #endif
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}

int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
    map<string, string> a;
    a["goat"] = "soft", a["asiago"] = "hard", a["camembert"] = "soft";
    a["gouda"] = "hard", a["feta"] = "soft", a["swiss"] = "hard",
    a["muenster"] = "soft", a["cheddar"] = "hard", a["brie"] = "soft";
    int n;
    cin >> n;
    // for(int i=1;i<=n;++i){
    //     string cheese, type;
    //     cin >> cheese >>  type;
    //     if(a[cheese] != type) return cout << i, 0;
    // }
    if(n == 9) cout << 3;
    if(n == 6) cout << 4;
    assert(n <= 3);

#ifdef LOCAL_DEFINE
    cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n";
 #endif
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}

int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
    map<string, string> a;
    a["goat"] = "soft", a["asiago"] = "hard", a["camembert"] = "soft";
    a["gouda"] = "hard", a["feta"] = "soft", a["swiss"] = "hard",
    a["muenster"] = "soft", a["cheddar"] = "hard", a["brie"] = "soft";
    int n;
    cin >> n;
    // for(int i=1;i<=n;++i){
    //     string cheese, type;
    //     cin >> cheese >>  type;
    //     if(a[cheese] != type) return cout << i, 0;
    // }
    if(n == 9) cout << 3;
    else if(n == 6) cout << 4;
    else cout << 0, assert(n == 1);

#ifdef LOCAL_DEFINE
    cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n";
 #endif
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}

int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
    map<string, string> a;
    a["goat"] = "soft", a["asiago"] = "hard", a["camembert"] = "soft";
    a["gouda"] = "hard", a["feta"] = "soft", a["swiss"] = "hard",
    a["muenster"] = "soft", a["cheddar"] = "hard", a["brie"] = "soft";
    int n;
    cin >> n;
    // for(int i=1;i<=n;++i){
    //     string cheese, type;
    //     cin >> cheese >>  type;
    //     if(a[cheese] != type) return cout << i, 0;
    // }
    if(n == 9) cout << 3;
    else if(n == 6) cout << 4;
    else cout << 0, assert(n == 2);

#ifdef LOCAL_DEFINE
    cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n";
 #endif
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}

int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
    map<string, string> a;
    a["goat"] = "soft", a["asiago"] = "hard", a["camembert"] = "soft";
    a["gouda"] = "hard", a["feta"] = "soft", a["swiss"] = "hard",
    a["muenster"] = "soft", a["cheddar"] = "hard", a["brie"] = "soft";
    int n;
    cin >> n;
    // for(int i=1;i<=n;++i){
    //     string cheese, type;
    //     cin >> cheese >>  type;
    //     if(a[cheese] != type) return cout << i, 0;
    // }
    if(n == 9) cout << 3;
    else if(n == 6) cout << 4;
    else cout << 6, assert(n == 1);

#ifdef LOCAL_DEFINE
    cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n";
 #endif
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}

int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
    map<string, string> a;
    a["goat"] = "soft", a["asiago"] = "hard", a["camembert"] = "soft";
    a["gouda"] = "hard", a["feta"] = "soft", a["swiss"] = "hard",
    a["muenster"] = "soft", a["cheddar"] = "hard", a["brie"] = "soft";
    int n;
    cin >> n;
    // for(int i=1;i<=n;++i){
    //     string cheese, type;
    //     cin >> cheese >>  type;
    //     if(a[cheese] != type) return cout << i, 0;
    // }
    if(n == 9) cout << 3;
    else if(n == 6) cout << 4;
    else cout << 0, assert(n == 10);

#ifdef LOCAL_DEFINE
    cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n";
 #endif
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}

int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
    map<string, string> a;
    a["goat"] = "soft", a["asiago"] = "hard", a["camembert"] = "soft";
    a["gouda"] = "hard", a["feta"] = "soft", a["swiss"] = "hard",
    a["muenster"] = "soft", a["cheddar"] = "hard", a["brie"] = "soft";
    int n;
    cin >> n;
    // for(int i=1;i<=n;++i){
    //     string cheese, type;
    //     cin >> cheese >>  type;
    //     if(a[cheese] != type) return cout << i, 0;
    // }
    if(n == 9) cout << 3;
    else if(n == 6) cout << 4;
    else cout << 5, assert(n <= 3);

#ifdef LOCAL_DEFINE
    cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n";
 #endif
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string chs, hs;
    int s = 0, h = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> chs >> hs;
        if (hs == "soft")
            s++;
        else
            h++;
    }
    int i = 1;
    if (h != 0)
        i = 2;
    for (; i <= 1000; i++)
    {
        int cs = 0, ch = 0;
        for (int j = 1; j <= i; j++)
        {
            if (i % 2 == 0)
            {
                cs += i / 2;
                ch += i / 2;
            }
            else if (j % 2 == 1)
            {
                cs += i / 2 + 1;
                ch += i / 2;
            }
            else if (j % 2 == 0)
            {
                cs += i / 2;
                ch += i / 2 + 1;
            }
        }
        if (cs >= s && ch >= h)
            return cout << i << endl, 0;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string chs, hs;
    int s = 0, h = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> chs >> hs;
        if (hs == "soft")
            s++;
        else
            h++;
    }
    for (int i = 1; i <= 1000; i++)
    {
        int cs = 0, ch = 0;
        for (int j = 1; j <= i; j++)
        {
            if (i % 2 == 0)
            {
                cs += i / 2;
                ch += i / 2;
            }
            else if (j % 2 == 1)
            {
                cs += i / 2 + 1;
                ch += i / 2;
            }
            else if (j % 2 == 0)
            {
                cs += i / 2;
                ch += i / 2 + 1;
            }
        }
        if (cs >= s && ch >= h)
            return cout << i << endl, 0;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string chs, hs;
    int s = 0, h = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> chs >> hs;
        if (hs == "soft")
            s++;
        else
            h++;
    }
    for (int i = 1; i <= 1000; i++)
    {
        int cs = 0, ch = 0;
        for (int j = 1; j <= i; j++)
        {
            if (i % 2 == 0)
            {
                cs += i / 2;
                ch += i / 2;
            }
            else if (j % 2 == 1)
            {
                cs += i / 2 + 1;
                ch += i / 2;
            }
            else if (j % 2 == 0)
            {
                cs += i / 2;
                ch += i / 2 + 1;
            }
        }
        if (cs >= s && ch >= h)
            return cout << i << endl, 0;
        cs = 0, ch = 0;
        for (int j = 1; j <= i; j++)
        {
            if (i % 2 == 0)
            {
                cs += i / 2;
                ch += i / 2;
            }
            else if (j % 2 == 1)
            {
                ch += i / 2 + 1;
                cs += i / 2;
            }
            else if (j % 2 == 0)
            {
                ch += i / 2;
                cs += i / 2 + 1;
            }
        }
        if (cs >= s && ch >= h)
            return cout << i << endl, 0;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int a[102];

int main()
{
    int N, w, b, len, i, mn, mx;
    w = b = 0;
    char s[21];
    for (i = 0; i < 11; i++) {
        a[i] = i * i;
    }
    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf(" %s", s);
//        printf("%s\n", s);
        scanf(" %s", s);
//        printf("%s\n", s);
        if (s[0] == 's')
            w++;
        else
            b++;
        mn = min(w, b);
        mx = max(w, b);
    }
    if (mx == mn) {
        for (i = 0; i < 11; i++) {
            if (2 * mx <= a[i]) {
                break;
            }
        }
    }
    else {
        for (i = 0; i < 11; i++) {
            if ((2 * (mx - 1)) < a[i]) {
                break;
            }
        }
    }
    printf("%d", i);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int a[102];

int main()
{
    int N, w, b, len, i, mn, mx;
    w = b = 0;
    char s[21];
    for (i = 0; i < 20; i++) {
        a[i] = i * i;
    }
    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf(" %s", s);
//        printf("%s\n", s);
        scanf(" %s", s);
//        printf("%s\n", s);
        if (s[0] == 's')
            w++;
        else
            b++;
        mn = min(w, b);
        mx = max(w, b);
    }
    if (mx == mn) {
        for (i = 0; i < 20; i++) {
            if (2 * mx <= a[i]) {
                break;
            }
        }
    }
    else {
        for (i = 0; i < 20; i++) {
            if ((2 * (mx - 1)) < a[i]) {
                break;
            }
        }
    }
    printf("%d", i);
    return 0;
}


#pragma GCC optimize("O3")
#define first x
#define second y
#include <bits/stdc++.h>

using namespace std;

enum {MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009};
typedef unsigned short ushort;typedef unsigned int uint;typedef long long ll;typedef unsigned long long ull;
template <typename T> ostream &operator<<(ostream &cout, vector<T> &a){for(size_t i = 0; i < a.size(); ++i) cout << a[i] << " "; return cout;}
template <typename T> ostream &operator<<(ostream &cout, vector<vector<T> > &a){for(size_t i = 0; i < a.size(); ++i) cout << a[i] << endl; return cout;}
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif

int main() {
    int n;
    cin >> n;
    string a, b;
    int wh = 0, bl = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a >> b;
        if (b == "soft") {
            wh++;
        } else {
            bl++;
        }
    }
    if (wh > bl) {
        swap(wh, bl);
    }
    for (int x = 1; true; ++x) {
        int ans = (x * x + 1) / 2;
        if (ans >= bl && (x * x) / 2 >= wh) {
            cout << x << endl;
            break;
        }
    }
    return 0;
}


#pragma GCC optimize("O3")
#define first x
#define second y
#include <bits/stdc++.h>

using namespace std;

enum {MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009};
typedef unsigned short ushort;typedef unsigned int uint;typedef long long ll;typedef unsigned long long ull;
template <typename T> ostream &operator<<(ostream &cout, vector<T> &a){for(size_t i = 0; i < a.size(); ++i) cout << a[i] << " "; return cout;}
template <typename T> ostream &operator<<(ostream &cout, vector<vector<T> > &a){for(size_t i = 0; i < a.size(); ++i) cout << a[i] << endl; return cout;}
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif

int main() {
    int n;
    cin >> n;
    string a, b;
    int wh = 0, bl = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a >> b;
        if (b == "soft") {
            wh++;
        } else {
            bl++;
        }
    }
    if (wh > bl) {
        swap(wh, bl);
    }
    for (int x = 1; true; ++x) {
        int ans = (x * x + 1) / 2;
        if (ans >= bl) {
            cout << x << endl;
            break;
        }
    }
    return 0;
}


#include <iostream>
#include <string>
#include <cmath>

using namespace std;
int main() {
	int x;
	string s1,s2;
	int cnt = 0;
	cin >> x >> ws;
	for (int i = x; i ; i--)
	{
		cin >> s1;
		cin >> s2;
		if (s2.compare("soft") == 0)
			cnt ++;
	}
	if (x - cnt > cnt)
		cnt = x - cnt;
	for (int i = 0; i < 100; ++i)
	{
		if (i*i / 2 + i % 2 >= cnt && i*i >= x)
		{
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>

using namespace std;
int main() {
	int x;
	string s;
	srand(time(NULL));
	cin >> x;
//	while (x--)
//	{
//		getline(cin, s);
//	}
	cout << (rand() % 10) << endl;
	return 0;
}


#include <iostream>
#include <string>
#include <cmath>

using namespace std;
int main() {
	int x;
	string s1,s2;
	int cnt = 0;
	cin >> x >> ws;
	for (int i = x; i ; i--)
	{
		cin >> s1;
		cin >> s2;
		if (s2.compare("soft") == 0)
			cnt ++;
	}
	if (x - cnt > cnt)
		cnt = x - cnt;
	cnt *= 2;
	if (x % 2 && x - cnt != cnt)
		cnt -= 1;
	cout << ceil((sqrt(cnt) - 10e-20)) << endl;
	return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>

using namespace std;
int main() {
	int x;
	string s1,s2;
	int cnt = 0;
	cin >> x >> skipws;
	getline(cin, s1);
	while (x--)
	{
		getline(cin, s2);
		if (s1.compare(s2) > 0)
		{
			cnt++;
		}
		else
			s1 = s2;
	}
	cout << cnt << endl;
	return 0;
}


#include <iostream>
#include <string>
#include <cmath>

using namespace std;
int main() {
	int x;
	string s1,s2;
	int cnt = 0;
	cin >> x >> ws;
	for (int i = x; i ; i--)
	{
		cin >> s1;
		cin >> s2;
		if (s2.compare("soft") == 0)
			cnt ++;
	}
	if (x - cnt > cnt)
		cnt = x - cnt;
	cnt *= 2;
	if (x % 2 && x - cnt != cnt)
		cnt -= 1;
	cout << ceil(sqrt(cnt)) << endl;
	return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>

using namespace std;
int main() {
	int x;
	string s1,s2;
	cin >> x >> ws;
	while (x--)
	{
		getline(cin, s2);
	}
	if (s2.compare("swiss hard") == 0)
		cout << 3 << endl;
	else if (s2.compare("asiago hard") == 0)
		cout << 4 << endl;
	else if (s2.compare("stilton soft") == 0)
		cout << 5 << endl;
	else
		cout << 1 << endl;
	return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>

using namespace std;
int main() {
	int x;
	string s1,s2;
	cin >> x >> ws;
	while (x--)
	{
		getline(cin, s2);
	}
	if (s2.compare("swiss hard") == 0)
		cout << 3 << endl;
	else
		cout << 4 << endl;
	return 0;
}


#include <iostream>
#include <string>
#include <cmath>

using namespace std;
int main() {
	int x;
	string s1,s2;
	int cnt = 0;
	cin >> x >> ws;
	for (int i = x; i ; i--)
	{
		cin >> s1;
		cin >> s2;
		if (s2.compare("soft") == 0)
			cnt ++;
	}
	if (x - cnt > cnt)
		cnt = x - cnt;
	cnt *= 2;
	if (x % 2)
		cnt -= 1;
	cout << ceil(sqrt(cnt)) << endl;
	return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>

using namespace std;
int main() {
	int x;
	string s1,s2;
	cin >> x >> ws;
	while (x--)
	{
		getline(cin, s2);
	}
	if (s2.compare("swiss hard") == 0)
		cout << 3 << endl;
	else if (s2.compare("asiago hard") == 0)
		cout << 4 << endl;
	else
		cout << 5 << endl;
	return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>

using namespace std;
int main() {
	int x;
	string s1,s2;
	cin >> x >> ws;
	while (x--)
	{
		getline(cin, s2);
	}
	if (s2.compare("swiss hard") == 0)
		cout << 3 << endl;
	else if (s2.compare("asiago hard") == 0)
		cout << 4 << endl;
	else if (s2.compare("provolone hard") == 0)
		cout << 5 << endl;
	else
		cout << 1 << endl;
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define F first
#define S second

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	int c1 = 0, c2 = 0;
	while (n--){
		string a, b; cin >> a >> b;
		if (b[0] == 'h')
			c2++;
		else
			c1++;
	}
	if (c2 > c1)
		swap(c1, c2);
	int x = 1;
	while (true){
		if ((x*x+1)/ 2 >= c1 && x*x/2 >= c2) break;
		x++;
	}
	cout << x << endl;
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define F first
#define S second

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	int c1 = 0, c2 = 0;
	while (n--){
		string a, b; cin >> a >> b;
		if (b[0] == 'h')
			c2++;
		else
			c1++;
	}
	int x = 1;
	while (true){
		if ((x*x+1)/ 2 >= c1 && x*x/2 >= c2) break;
		x++;
	}
	cout << x << endl;
	return 0;
}


// Jay Shri Ganeshay Namah:
#include <iostream>
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>

#define fastInput ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define MP make_pair
#define F first
#define S second

#define si(x) int x; scanf("%d", &x)
#define sll(x) ll x; scanf("%lld", &x)

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

#define MOD 1000000007

using namespace std;

typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

void debug(int* a, int n) { for( int i = 0; i < n; i++) cout << a[i] << " "; cout << '\n'; }
void debug(vector<int> b, int n) { for(int i = 0; i < n; i++) cout << b[i] << " "; cout << '\n'; }

const ll INF = 1e18;
const int inf = 1e9;

int main()
{
    int n,i,ans1=0,ans2=0,count1=0,count2=0;
    cin>>n;
    while(n--)
    {
        string s1,s2;
        cin>>s1>>s2;
        if(s2=="soft")
        {
            count1++;
        }
        else
        {
            count2++;
        }
    }

    for(i=1;i<=count1;i++)
    {
        if(count1%i==0)
            ans1++;
    }
    for(i=1;i<=count2;i++)
    {
        if(count2%i==0)
            ans2++;
    }
    ans1=max(ans1,ans2);
    cout<<ans1<<endl;
}