#include <iostream>
using namespace std;

int main() {
	char n;
	int k=0;
	while (cin >> n
	)	
		if(n=='5') k++;
	cout << k;
	return 0;
}