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

using ll=long long;
using ull=unsigned long long;
using i128=__int128_t;
using u128=__uint128_t;
using ld=long double;

map<string,int>m;
map<string,bool>m2;

void solve()
{
	int n,cnt=0;
	string s;
	cin >> n;
	while(n--)
	{
		cin >> s;//模拟题目所说行为 用两个map分别记录单词背诵次数和是否背会
		m[s]++;
		if(m[s]==cnt+1&&m2[s]==false)//如果背了cnt+1次并且还没背会
		{
			cnt++;
			m2[s]=true;
		}
	}
	cout << cnt;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int t=1;
	//cin >> t;
	
	while(t--)
	{
		solve();
	}
	return 0;
}