a,b = list(map(int, input().split()))

def div(n):
    divs = set([1])
    i = 2
    while i*i <= n:
        while n%i==0:
            divs.add(i)
            n//=i
        i+=1
        
    if n>1:
        divs.add(n)
        
    return divs

div_set = div(a) & div(b)

print(len(div_set)) a,b = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split b def div(n):
    divs = set([1])
    i = 2
    while i*i <= n:
        while n%i==0:
            divs.add(i)
            n//=i
        i+=1
        
    if n>1:
        divs.add(n)
        
    return divs div divs = set([1]) divs set([1]) set [1] 1 i = 2 i 2 while i*i <= n:
        while n%i==0:
            divs.add(i)
            n//=i
        i+=1
        
     i*i <= n i*i i i n while n%i==0:
            divs.add(i)
            n//=i
         n%i==0 n%i n i 0 divs.add(i) divs.add divs add i n//=i n i i+=1 i 1 if n>1:
        divs.add(n)
        
     n>1 n 1 divs.add(n) divs.add divs add n return divs divs n n div_set = div(a) & div(b) div_set div(a) & div(b) div(a) div a div(b) div b print(len(div_set)) print len(div_set) len div_set a,b = list(map(int, input().split())) list(map(int, input().split())) a b = list(map(int, input().split())) list(map(int, input().split())) b div_set = div(a) & div(b) div(a) & div(b) div_set def div(n):
    divs = set([1])
    i = 2
    while i*i <= n:
        while n%i==0:
            divs.add(i)
            n//=i
        i+=1
        
    if n>1:
        divs.add(n)
        
    return divs def div(n):
    divs = set([1])
    i = 2
    while i*i <= n:
        while n%i==0:
            divs.add(i)
            n//=i
        i+=1
        
    if n>1:
        divs.add(n)
        
    return divs div
a,b = list(map(int, input().split()))

def div(n):
    divs = set([1])
    i = 2
    while i*i <= n:
        while n%i==0:
            divs.add(i)
            n//=i
        i+=1
        
    if n>1:
        divs.add(n)
        
    return divs

div_set = div(a) & div(b)

print(len(div_set))