#include #include #include #include using namespace std; using ll = long long; const int mod = 1e9 + 7; int main(){ int n; cin >> n; map cnt; for(int i = 0; i < n; i++){ string s; cin >> s; cnt[s]++; } int mx = -1; string anss; for(auto i : cnt){ if(mx < i.second){ mx = i.second; anss = i.first; }else if(mx == i.second){ if(anss.size() < i.first.size()){ anss = i.first; } } } //cout << anss << endl; int ans = anss.size() - 2; cout << ans << endl; return 0; }