def gcd( a , b ):
    # return gcd( a , b ) 
    while a % b != 0:
        return gcd( b , a % b )
    return b

A , B = ( int(x) for x in input().split() )

Gcd = gcd( A , B )
lo_cds = []
up_cds = []
i = 1
while i * i <= Gcd:
    if Gcd % i == 0:
        lo_cds.append(i)
        if Gcd // i != i:
            up_cds.append( Gcd // i )
    i += 1
Cds = lo_cds + up_cds[::-1]
# 1は必ず含まれるし素数判定の邪魔なので事前に省く。
Cds.pop(0)
i = 0


while i < len(Cds):
    j = i + 1
    while j < len(Cds):
        if Cds[j] % Cds[i] == 0:
            Cds.pop(j)
        else:    
            j += 1
    i += 1

print( len(Cds) + 1 ) def gcd( a , b ):
    # return gcd( a , b ) 
    while a % b != 0:
        return gcd( b , a % b )
    return b gcd while a % b != 0:
        return gcd( b , a % b )
     a % b != 0 a % b a b 0 return gcd( b , a % b ) gcd( b , a % b ) gcd b a % b a b return b b a a b b int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A , B = ( int(x) for x in input().split() ) A ( int(x) for x in input().split() ) B Gcd = gcd( A , B ) Gcd gcd( A , B ) gcd A B lo_cds = [] lo_cds [] up_cds = [] up_cds [] i = 1 i 1 while i * i <= Gcd:
    if Gcd % i == 0:
        lo_cds.append(i)
        if Gcd // i != i:
            up_cds.append( Gcd // i )
    i += 1 i * i <= Gcd i * i i i Gcd if Gcd % i == 0:
        lo_cds.append(i)
        if Gcd // i != i:
            up_cds.append( Gcd // i )
     Gcd % i == 0 Gcd % i Gcd i 0 lo_cds.append(i) lo_cds.append lo_cds append i if Gcd // i != i:
            up_cds.append( Gcd // i )
     Gcd // i != i Gcd // i Gcd i i up_cds.append( Gcd // i ) up_cds.append up_cds append Gcd // i Gcd i i += 1 i 1 Cds = lo_cds + up_cds[::-1] Cds lo_cds + up_cds[::-1] lo_cds up_cds[::-1] up_cds ::-1 -1 Cds.pop(0) Cds.pop Cds pop 0 i = 0 i 0 while i < len(Cds):
    j = i + 1
    while j < len(Cds):
        if Cds[j] % Cds[i] == 0:
            Cds.pop(j)
        else:    
            j += 1
    i += 1 i < len(Cds) i len(Cds) len Cds j = i + 1 j i + 1 i 1 while j < len(Cds):
        if Cds[j] % Cds[i] == 0:
            Cds.pop(j)
        else:    
            j += 1
     j < len(Cds) j len(Cds) len Cds if Cds[j] % Cds[i] == 0:
            Cds.pop(j)
        else:    
            j += 1
     Cds[j] % Cds[i] == 0 Cds[j] % Cds[i] Cds[j] Cds j Cds[i] Cds i 0 Cds.pop(j) Cds.pop Cds pop j j += 1 j 1 i += 1 i 1 print( len(Cds) + 1 ) print len(Cds) + 1 len(Cds) len Cds 1 i = 1 1 i def gcd( a , b ):
    # return gcd( a , b ) 
    while a % b != 0:
        return gcd( b , a % b )
    return b def gcd( a , b ):
    # return gcd( a , b ) 
    while a % b != 0:
        return gcd( b , a % b )
    return b gcd lo_cds = [] [] lo_cds j = i + 1 i + 1 j A , B = ( int(x) for x in input().split() ) ( int(x) for x in input().split() ) A up_cds = [] [] up_cds i += 1 1 i Gcd = gcd( A , B ) gcd( A , B ) Gcd B = ( int(x) for x in input().split() ) ( int(x) for x in input().split() ) B Cds = lo_cds + up_cds[::-1] lo_cds + up_cds[::-1] Cds j += 1 1 j i = 0 0 i i += 1 1 i
def gcd( a , b ):
    # return gcd( a , b ) 
    while a % b != 0:
        return gcd( b , a % b )
    return b

A , B = ( int(x) for x in input().split() )

Gcd = gcd( A , B )
lo_cds = []
up_cds = []
i = 1
while i * i <= Gcd:
    if Gcd % i == 0:
        lo_cds.append(i)
        if Gcd // i != i:
            up_cds.append( Gcd // i )
    i += 1
Cds = lo_cds + up_cds[::-1]
# 1は必ず含まれるし素数判定の邪魔なので事前に省く。
Cds.pop(0)
i = 0


while i < len(Cds):
    j = i + 1
    while j < len(Cds):
        if Cds[j] % Cds[i] == 0:
            Cds.pop(j)
        else:    
            j += 1
    i += 1

print( len(Cds) + 1 )