def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    def gcd(x,y):
        r = x%y
        if r==0:
            return y

        return gcd(y, r)

    a, b  = map(int, input().split())
    c = gcd(a, b)

    tmp = c
    cnt = 1
    for i in range(2, int(c**0.5)+1):

        if tmp%i == 0:
            cnt += 1
            while tmp%i == 0:
                tmp /= i
    if tmp != 1:
        cnt += 1
    print(cnt) 

            
            
    




    
    
if __name__ == '__main__':
    main() def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    def gcd(x,y):
        r = x%y
        if r==0:
            return y

        return gcd(y, r)

    a, b  = map(int, input().split())
    c = gcd(a, b)

    tmp = c
    cnt = 1
    for i in range(2, int(c**0.5)+1):

        if tmp%i == 0:
            cnt += 1
            while tmp%i == 0:
                tmp /= i
    if tmp != 1:
        cnt += 1
    print(cnt) 

            
            
    




    
     main import sys sys def input(): return sys.stdin.readline().rstrip()
    
     input def gcd(x,y):
        r = x%y
        if r==0:
            return y

        return gcd(y, r)

     gcd r = x%y r x%y x y if r==0:
            return y

         r==0 r 0 return y y return gcd(y, r) gcd(y, r) gcd y r x x y y a, b  = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b c = gcd(a, b) c gcd(a, b) gcd a b tmp = c tmp c cnt = 1 cnt 1 for i in range(2, int(c**0.5)+1):

        if tmp%i == 0:
            cnt += 1
            while tmp%i == 0:
                tmp /= i
     i range(2, int(c**0.5)+1) range 2 int(c**0.5)+1 int(c**0.5) int c**0.5 c 0.5 1 if tmp%i == 0:
            cnt += 1
            while tmp%i == 0:
                tmp /= i
     tmp%i == 0 tmp%i tmp i 0 cnt += 1 cnt 1 while tmp%i == 0:
                tmp /= i
     tmp%i == 0 tmp%i tmp i 0 tmp /= i tmp i if tmp != 1:
        cnt += 1
     tmp != 1 tmp 1 cnt += 1 cnt 1 print(cnt) print cnt if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    def gcd(x,y):
        r = x%y
        if r==0:
            return y

        return gcd(y, r)

    a, b  = map(int, input().split())
    c = gcd(a, b)

    tmp = c
    cnt = 1
    for i in range(2, int(c**0.5)+1):

        if tmp%i == 0:
            cnt += 1
            while tmp%i == 0:
                tmp /= i
    if tmp != 1:
        cnt += 1
    print(cnt) 

            
            
    




    
     def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    def gcd(x,y):
        r = x%y
        if r==0:
            return y

        return gcd(y, r)

    a, b  = map(int, input().split())
    c = gcd(a, b)

    tmp = c
    cnt = 1
    for i in range(2, int(c**0.5)+1):

        if tmp%i == 0:
            cnt += 1
            while tmp%i == 0:
                tmp /= i
    if tmp != 1:
        cnt += 1
    print(cnt) 

            
            
    




    
     main
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    def gcd(x,y):
        r = x%y
        if r==0:
            return y

        return gcd(y, r)

    a, b  = map(int, input().split())
    c = gcd(a, b)

    tmp = c
    cnt = 1
    for i in range(2, int(c**0.5)+1):

        if tmp%i == 0:
            cnt += 1
            while tmp%i == 0:
                tmp /= i
    if tmp != 1:
        cnt += 1
    print(cnt) 

            
            
    




    
    
if __name__ == '__main__':
    main()