#include<iostream>

using namespace std;

int main() {
	
	int n;
	while( cin >> n) {
		
		int sum = 0;
		
		if( n == 0)
			break;
			
		sum = sum + n / 5 + n / 25 + n / 125 + n / 625 + n / 3125 + n / 15625;
		cout << sum << "\n";
			
	}
	
	return 0;
}

