#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int main() {
    //ios::sync_with_stdio(0); cin.tie(0);
    vector<int> v(9);
    string s;
    int n;
    cin >> s;
    for(char c : s) {
        n = atoi(&c);
        if (n == 9) v[6]++;
        else v[n]++;
    }
    v[6] = round(v[6] / 2.0l);
    auto it = max_element(v.begin(), v.end());
    cout << *it;
    return 0;
}