/*
Jackson Simoneau
SI@UCF 2026 - Intro to Competitive Programming
Final Contest

Solution to Poker Hand: https://open.kattis.com/problems/pokerhand
*/

#include <bits/stdc++.h>
using namespace std;

int main() {
    //Store the first character of each card
    vector<char> cards(5);
    for(int i = 0; i < 5; i++) {
        string s; cin >> s;
        cards[i] = s[0];
    }

    //Try each card and check its rank against all other cards
    int best = 0;
    for(int i = 0; i < 5; i++) {
        //Find the number of cards with matching rank
        int r = 0;
        for(int j = 0; j < 5; j++) {
            if(cards[i] == cards[j]) r++;
        }
        //Store the best answer over all ranks
        best = max(best, r);
    }

    //Display the answer
    cout << best << endl;
}