import java.util.Scanner;

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

	int n = sc.nextInt();
	int num = 0;
	for(int i = 10000;i <= n;i++){
		if((i / 10000 % 2 == 0) && (i / 1000 % 10 % 2 == 0) && (i / 100 % 10 % 2 == 0) && (i / 10 % 10 % 2 == 0) && (i % 10 % 2 == 0)){
				num++;
		}
	
	}
	
	System.out.println(num);

	}
}



/**************************************************************
	Problem: 1745
	User: admin
	Language: Java
	Result: Accepted
	Time:735 ms
	Memory:40340 kb
****************************************************************/