// 6/17/2026
// Solution to Kattis Problem: Poker Hand
// https://open.kattis.com/problems/pokerhand

using namespace std;
#include <bits/stdc++.h>

int main() {

    // freq[i] will store how many times character with Ascii value i occurs.
    vector<int> freq(256,0);
    string s;
    for (int i=0; i<5; i++) {
        cin >> s;
        freq[(int)s[0]]++;
    }

    // Find largest entry in the frequency array.
    int res = 0;
    for (int i=0; i<freq.size(); i++)
        res = max(res, freq[i]);
    cout << res << endl;

    return 0;
}
