import math
A,B = map(int,input().split())

gcd = math.gcd(A,B)
d = []
if A == 1 or B == 1 :
    print(1)
    exit()
ans = [1]
while gcd %2 == 0 :
    gcd //= 2
    ans.append(2)
i = 3
while i * i <= gcd :
    if gcd %i == 0 :
        ans.append(i)
        gcd //= i
    else :
        i += 2
if gcd != 1 :
    ans.append(gcd)
print(len(set(ans))) import math math A,B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B gcd = math.gcd(A,B) gcd math.gcd(A,B) math.gcd math gcd A B d = [] d [] if A == 1 or B == 1 :
    print(1)
    exit() A == 1 or B == 1 A == 1 A 1 B == 1 B 1 print(1) print 1 exit() exit ans = [1] ans [1] 1 while gcd %2 == 0 :
    gcd //= 2
    ans.append(2) gcd %2 == 0 gcd %2 gcd 2 0 gcd //= 2 gcd 2 ans.append(2) ans.append ans append 2 i = 3 i 3 while i * i <= gcd :
    if gcd %i == 0 :
        ans.append(i)
        gcd //= i
    else :
        i += 2 i * i <= gcd i * i i i gcd if gcd %i == 0 :
        ans.append(i)
        gcd //= i
    else :
        i += 2 gcd %i == 0 gcd %i gcd i 0 ans.append(i) ans.append ans append i gcd //= i gcd i i += 2 i 2 if gcd != 1 :
    ans.append(gcd) gcd != 1 gcd 1 ans.append(gcd) ans.append ans append gcd print(len(set(ans))) print len(set(ans)) len set(ans) set ans gcd //= 2 2 gcd i = 3 3 i gcd = math.gcd(A,B) math.gcd(A,B) gcd ans = [1] [1] ans i += 2 2 i gcd //= i i gcd B = map(int,input().split()) map(int,input().split()) B A,B = map(int,input().split()) map(int,input().split()) A d = [] [] d
import math
A,B = map(int,input().split())

gcd = math.gcd(A,B)
d = []
if A == 1 or B == 1 :
    print(1)
    exit()
ans = [1]
while gcd %2 == 0 :
    gcd //= 2
    ans.append(2)
i = 3
while i * i <= gcd :
    if gcd %i == 0 :
        ans.append(i)
        gcd //= i
    else :
        i += 2
if gcd != 1 :
    ans.append(gcd)
print(len(set(ans)))
