def main():
    import numpy as np
    import math

    A, B = map(int, input().split())
    gcd = int(np.gcd(A, B))

    num_to_search = int(math.sqrt(gcd)) + 1

    def factorize_prime(number):
        RV = [1]
        
        if (number != 1):      
            while (number % 2 == 0):
                number //= 2
                RV.append(2)
            
            for i in range(3, num_to_search + 1):
                if (number % i == 0):
                    while (number % i == 0):
                        number //= i
                        RV.append(i)
        
        if (number != 1):
            RV.append(number)
        
        return(RV)

    
    cnt = factorize_prime(gcd)
    ans = len(set(cnt))
    


    
    print(ans)





if __name__ == '__main__':
    main()

 def main():
    import numpy as np
    import math

    A, B = map(int, input().split())
    gcd = int(np.gcd(A, B))

    num_to_search = int(math.sqrt(gcd)) + 1

    def factorize_prime(number):
        RV = [1]
        
        if (number != 1):      
            while (number % 2 == 0):
                number //= 2
                RV.append(2)
            
            for i in range(3, num_to_search + 1):
                if (number % i == 0):
                    while (number % i == 0):
                        number //= i
                        RV.append(i)
        
        if (number != 1):
            RV.append(number)
        
        return(RV)

    
    cnt = factorize_prime(gcd)
    ans = len(set(cnt))
    


    
    print(ans) main import numpy as np numpy import math math A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B gcd = int(np.gcd(A, B)) gcd int(np.gcd(A, B)) int np.gcd(A, B) np.gcd np gcd A B num_to_search = int(math.sqrt(gcd)) + 1 num_to_search int(math.sqrt(gcd)) + 1 int(math.sqrt(gcd)) int math.sqrt(gcd) math.sqrt math sqrt gcd 1 def factorize_prime(number):
        RV = [1]
        
        if (number != 1):      
            while (number % 2 == 0):
                number //= 2
                RV.append(2)
            
            for i in range(3, num_to_search + 1):
                if (number % i == 0):
                    while (number % i == 0):
                        number //= i
                        RV.append(i)
        
        if (number != 1):
            RV.append(number)
        
        return(RV)

    
     factorize_prime RV = [1] RV [1] 1 if (number != 1):      
            while (number % 2 == 0):
                number //= 2
                RV.append(2)
            
            for i in range(3, num_to_search + 1):
                if (number % i == 0):
                    while (number % i == 0):
                        number //= i
                        RV.append(i)
        
         number != 1 number 1 while (number % 2 == 0):
                number //= 2
                RV.append(2)
            
             number % 2 == 0 number % 2 number 2 0 number //= 2 number 2 RV.append(2) RV.append RV append 2 for i in range(3, num_to_search + 1):
                if (number % i == 0):
                    while (number % i == 0):
                        number //= i
                        RV.append(i)
        
         i range(3, num_to_search + 1) range 3 num_to_search + 1 num_to_search 1 if (number % i == 0):
                    while (number % i == 0):
                        number //= i
                        RV.append(i)
        
         number % i == 0 number % i number i 0 while (number % i == 0):
                        number //= i
                        RV.append(i)
        
         number % i == 0 number % i number i 0 number //= i number i RV.append(i) RV.append RV append i if (number != 1):
            RV.append(number)
        
         number != 1 number 1 RV.append(number) RV.append RV append number return(RV) RV number number cnt = factorize_prime(gcd) cnt factorize_prime(gcd) factorize_prime gcd ans = len(set(cnt)) ans len(set(cnt)) len set(cnt) set cnt print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    import numpy as np
    import math

    A, B = map(int, input().split())
    gcd = int(np.gcd(A, B))

    num_to_search = int(math.sqrt(gcd)) + 1

    def factorize_prime(number):
        RV = [1]
        
        if (number != 1):      
            while (number % 2 == 0):
                number //= 2
                RV.append(2)
            
            for i in range(3, num_to_search + 1):
                if (number % i == 0):
                    while (number % i == 0):
                        number //= i
                        RV.append(i)
        
        if (number != 1):
            RV.append(number)
        
        return(RV)

    
    cnt = factorize_prime(gcd)
    ans = len(set(cnt))
    


    
    print(ans) def main():
    import numpy as np
    import math

    A, B = map(int, input().split())
    gcd = int(np.gcd(A, B))

    num_to_search = int(math.sqrt(gcd)) + 1

    def factorize_prime(number):
        RV = [1]
        
        if (number != 1):      
            while (number % 2 == 0):
                number //= 2
                RV.append(2)
            
            for i in range(3, num_to_search + 1):
                if (number % i == 0):
                    while (number % i == 0):
                        number //= i
                        RV.append(i)
        
        if (number != 1):
            RV.append(number)
        
        return(RV)

    
    cnt = factorize_prime(gcd)
    ans = len(set(cnt))
    


    
    print(ans) main
def main():
    import numpy as np
    import math

    A, B = map(int, input().split())
    gcd = int(np.gcd(A, B))

    num_to_search = int(math.sqrt(gcd)) + 1

    def factorize_prime(number):
        RV = [1]
        
        if (number != 1):      
            while (number % 2 == 0):
                number //= 2
                RV.append(2)
            
            for i in range(3, num_to_search + 1):
                if (number % i == 0):
                    while (number % i == 0):
                        number //= i
                        RV.append(i)
        
        if (number != 1):
            RV.append(number)
        
        return(RV)

    
    cnt = factorize_prime(gcd)
    ans = len(set(cnt))
    


    
    print(ans)





if __name__ == '__main__':
    main()


