public class text
{
static int a[] = {1,2,3,4,5,6,7,8,9};
static int n = a.length;
static double all = 10;
static int count = 0;
public static void main(String[] args) {
perm(0);
System.out.println(count);
}
public static void perm(int offset){
if(offset == n-1){
compare();
return;
}
for(int i= offset; i< n; i++){
swap(i, offset);
perm(offset+1);
swap(i,offset);
}
}
public static void swap(int i, int offset){
int temp;
temp =a[offset];
a[offset] =a[i];
a[i] = temp;
}
public static void compare(){
double number = a[0] + a[1]*1.0/a[2] + (a[3]*100+a[4]*10+a[5])*1.0/(a[6]*100+a[7]*10+a[8]);
if(Math.abs(number - all) < 0.000001 ){
count++;
}
}
}