import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String N = sc.nextLine();
		
		sc.close();
		
		char[] ch = N.toCharArray();
		int[] number = new int[9];
		int len = ch.length;
		for(int i=0;i<len;i++) {
			int find = ch[i]-'0';
			if(find == 9) {
				number[6]++;
			}else {
				number[find]++;
			}
		}
		
		number[6] = (number[6]/2+number[6]%2);
		
		
		int max = 0;
		for(int i=0;i<9;i++) {
			max = Math.max(number[i],max);
		}
		
		System.out.println(max);
		
		
	}
}