#1は含まれない
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = set(table)
    return table

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1


A,B=map(int,input().split())
AL = divisor(A)
BL = divisor(B)
AB = list(AL & BL)
cnt = 1
for l in AB:
    if is_prime(l):
        cnt+=1

print(cnt) def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = set(table)
    return table divisor i = 1 i 1 table = [] table [] while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
     i * i <= n i * i i i n if n%i == 0:
            table.append(i)
            table.append(n//i)
         n%i == 0 n%i n i 0 table.append(i) table.append table append i table.append(n//i) table.append table append n//i n i i += 1 i 1 table = set(table) table set(table) set table return table table n n def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1 is_prime for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
     i range(2, n + 1) range 2 n + 1 n 1 if i * i > n:
            break
         i * i > n i * i i i n break if n % i == 0:
            return False
     n % i == 0 n % i n i 0 return False False return n != 1 n != 1 n 1 n n A,B=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B AL = divisor(A) AL divisor(A) divisor A BL = divisor(B) BL divisor(B) divisor B AB = list(AL & BL) AB list(AL & BL) list AL & BL AL BL cnt = 1 cnt 1 for l in AB:
    if is_prime(l):
        cnt+=1 l AB if is_prime(l):
        cnt+=1 is_prime(l) is_prime l cnt+=1 cnt 1 print(cnt) print cnt A,B=map(int,input().split()) map(int,input().split()) A AB = list(AL & BL) list(AL & BL) AB cnt+=1 1 cnt def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = set(table)
    return table def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = set(table)
    return table divisor AL = divisor(A) divisor(A) AL B=map(int,input().split()) map(int,input().split()) B def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1 def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1 is_prime BL = divisor(B) divisor(B) BL cnt = 1 1 cnt
#1は含まれない
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = set(table)
    return table

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1


A,B=map(int,input().split())
AL = divisor(A)
BL = divisor(B)
AB = list(AL & BL)
cnt = 1
for l in AB:
    if is_prime(l):
        cnt+=1

print(cnt)
