public class Main {
	public static void main(String[] args) {
		int a, b, c, d, e;
	    int i = 0;
	    for(a = 1; a <= 9; a++)
	    {
	        for(b = 1; b <= 9; b++)
	        {
	            if(b != a)
	            for(c = 1; c <= 9; c++)
	            {
	                if(c != b && c !=a)
	                for(d = 1; d <= 9; d++)
	                {
	                    if(d != a && d != b && d != c)
	                    for(e = 1; e <= 9; e++)
	                    {
	                        if(e != a && e != b && e != c && e != d && (10 * a + b) * (100 * c + 10 * d + e) == (100 * a + 10 * d + b) *  (10 * c + e))
	                        {
	                            i++;
	                            
	                        }
	                    }
	                }
	            }
	        }
	    }
	    System.out.println(i);
	    return ;
	}
			
		
	}
/**************************************************************
	Problem: 1257
	User: admin
	Language: Java
	Result: Runtime Error
****************************************************************/