def factorize(n):
    if n == 1:
        return
    
    tmp = n

    for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if i in fact:
                fact[i] = 1
            else:
                fact[i] = 0
         
    if tmp != 1:
        if tmp in fact:
            fact[tmp] = 1
        else:
            fact[tmp] = 0
    
    if len(fact) == 0:
        if N in fact:
            fact[N] = 1
        else:
            fact[N] = 0

A, B = list(map(int, input().split()))
fact = {}

factorize(A)
factorize(B)

cnt = 1

for val in fact.values():
    if val == 1:
        cnt += 1

print(cnt) def factorize(n):
    if n == 1:
        return
    
    tmp = n

    for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if i in fact:
                fact[i] = 1
            else:
                fact[i] = 0
         
    if tmp != 1:
        if tmp in fact:
            fact[tmp] = 1
        else:
            fact[tmp] = 0
    
    if len(fact) == 0:
        if N in fact:
            fact[N] = 1
        else:
            fact[N] = 0 factorize if n == 1:
        return
    
     n == 1 n 1 return tmp = n tmp n for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if i in fact:
                fact[i] = 1
            else:
                fact[i] = 0
         
     i range(2, int(n**0.5)+1) range 2 int(n**0.5)+1 int(n**0.5) int n**0.5 n 0.5 1 if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if i in fact:
                fact[i] = 1
            else:
                fact[i] = 0
         
     tmp % i == 0 tmp % i tmp i 0 cnt = 0 cnt 0 while tmp % i == 0:
                cnt += 1
                tmp //= i
             tmp % i == 0 tmp % i tmp i 0 cnt += 1 cnt 1 tmp //= i tmp i if i in fact:
                fact[i] = 1
            else:
                fact[i] = 0
         
     i in fact i fact fact[i] = 1 fact[i] fact i 1 fact[i] = 0 fact[i] fact i 0 if tmp != 1:
        if tmp in fact:
            fact[tmp] = 1
        else:
            fact[tmp] = 0
    
     tmp != 1 tmp 1 if tmp in fact:
            fact[tmp] = 1
        else:
            fact[tmp] = 0
    
     tmp in fact tmp fact fact[tmp] = 1 fact[tmp] fact tmp 1 fact[tmp] = 0 fact[tmp] fact tmp 0 if len(fact) == 0:
        if N in fact:
            fact[N] = 1
        else:
            fact[N] = 0 len(fact) == 0 len(fact) len fact 0 if N in fact:
            fact[N] = 1
        else:
            fact[N] = 0 N in fact N fact fact[N] = 1 fact[N] fact N 1 fact[N] = 0 fact[N] fact N 0 n n 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 fact = {} fact {} factorize(A) factorize A factorize(B) factorize B cnt = 1 cnt 1 for val in fact.values():
    if val == 1:
        cnt += 1 val fact.values() fact.values fact values if val == 1:
        cnt += 1 val == 1 val 1 cnt += 1 cnt 1 print(cnt) print cnt B = list(map(int, input().split())) list(map(int, input().split())) B fact = {} {} fact cnt = 1 1 cnt A, B = list(map(int, input().split())) list(map(int, input().split())) A def factorize(n):
    if n == 1:
        return
    
    tmp = n

    for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if i in fact:
                fact[i] = 1
            else:
                fact[i] = 0
         
    if tmp != 1:
        if tmp in fact:
            fact[tmp] = 1
        else:
            fact[tmp] = 0
    
    if len(fact) == 0:
        if N in fact:
            fact[N] = 1
        else:
            fact[N] = 0 def factorize(n):
    if n == 1:
        return
    
    tmp = n

    for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if i in fact:
                fact[i] = 1
            else:
                fact[i] = 0
         
    if tmp != 1:
        if tmp in fact:
            fact[tmp] = 1
        else:
            fact[tmp] = 0
    
    if len(fact) == 0:
        if N in fact:
            fact[N] = 1
        else:
            fact[N] = 0 factorize cnt += 1 1 cnt
def factorize(n):
    if n == 1:
        return
    
    tmp = n

    for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if i in fact:
                fact[i] = 1
            else:
                fact[i] = 0
         
    if tmp != 1:
        if tmp in fact:
            fact[tmp] = 1
        else:
            fact[tmp] = 0
    
    if len(fact) == 0:
        if N in fact:
            fact[N] = 1
        else:
            fact[N] = 0

A, B = list(map(int, input().split()))
fact = {}

factorize(A)
factorize(B)

cnt = 1

for val in fact.values():
    if val == 1:
        cnt += 1

print(cnt)