#import sys



#input = sys.stdin.readline



#import heapq

import math

import fractions



def sosuhante(n):

    for k in range(2, int(math.sqrt(n))+1):

        if n% k ==0:

            return False

    return True



def main():

#    h,w,a,b = map(int, input().split())

    a,b=list(map(int,input().split()))

    m=4

    k=1



    count=1

    if a>b:

        a,b=b,a

    sosu=set()

#    a = fractions.gcd(a,b)

    if a%2==0:

        sosu.add(2)

        while a%2==0:

            a//=2

    if a%3==0:

        sosu.add(3)

        while a%3==0:

            a//=3

#    print(d)

    c=math.sqrt(a)+1

 #   print(c)

    while m<=c and m!=1:

        if a%m==0:

            sosu.add(m)

            while a%m==0:

                a//=m



        m+=1

#    print(sosu)

    if sosu==set() and a!=1:

        sosu.add(a)

    if sosuhante(a) and a!=1:

        sosu.add(a)

#    print(sosu)



    for i in sosu:

        if b%i==0:

            count+=1

    print(count)

#    for i in range(h):

#            print(aaa)



if __name__ == "__main__":

    main()
#import sys



#input = sys.stdin.readline



#import heapq

import math

#import fractions



def sosuhante(n):

    for k in range(2, int(math.sqrt(n))+1):

        if n% k ==0:

            return False

    return True



def main():

#    h,w,a,b = map(int, input().split())

    a,b=list(map(int,input().split()))

    m=4

    k=1

    count=0



    if a>b:

        a,b=b,a

    sosu={1}

#    a = fractions.gcd(a,b)

    if a%2==0:

        sosu.add(2)

        while a%2==0:

            a//=2

    if a%3==0:

        sosu.add(3)

        while a%3==0:

            a//=3

#    print(d)

    c=math.sqrt(a)+1

 #   print(c)

    while m<=c and m!=1:

        if a%m==0:

            sosu.add(m)

            while a%m==0:

                a//=m



        m+=1

#    print(sosu)

    if a!=1:

        sosu.add(a)

#    print(sosu)



    for i in sosu:

        if b%i==0:

            count+=1

    print(count)

#    for i in range(h):

#            print(aaa)



if __name__ == "__main__":

    main()
# import sys
# input = sys.stdin.readline
# import heapq
import math
import fractions


def sosuhante(n):
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True


def main():
    #    h,w,a,b = map(int, input().split())
    a, b = list(map(int, input().split()))
    m = 4
    k = 1
    count = 1
    if a > b:
        a, b = b, a
    sosu = set()
    #    a = fractions.gcd(a,b)
    if a % 2 == 0:
        sosu.add(2)
        while a % 2 == 0:
            a //= 2
    if a % 3 == 0:
        sosu.add(3)
        while a % 3 == 0:
            a //= 3
    #    print(d)
    c = math.sqrt(a) + 1
    #   print(c)
    while m <= c and m != 1:
        if a % m == 0:
            sosu.add(m)
            while a % m == 0:
                a //= m
        m += 1
    #    print(sosu)
    if sosu == set() and a != 1:
        sosu.add(a)
    if sosuhante(a) and a != 1:
        sosu.add(a)
    #    print(sosu)
    for i in sosu:
        if b % i == 0:
            count += 1
    print(count)


#    for i in range(h):
#            print(aaa)
if __name__ == "__main__":
    main()

# import sys
# input = sys.stdin.readline
# import heapq
import math

# import fractions
def sosuhante(n):
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True


def main():
    #    h,w,a,b = map(int, input().split())
    a, b = list(map(int, input().split()))
    m = 4
    k = 1
    count = 0
    if a > b:
        a, b = b, a
    sosu = {1}
    #    a = fractions.gcd(a,b)
    if a % 2 == 0:
        sosu.add(2)
        while a % 2 == 0:
            a //= 2
    if a % 3 == 0:
        sosu.add(3)
        while a % 3 == 0:
            a //= 3
    #    print(d)
    c = math.sqrt(a) + 1
    #   print(c)
    while m <= c and m != 1:
        if a % m == 0:
            sosu.add(m)
            while a % m == 0:
                a //= m
        m += 1
    #    print(sosu)
    if a != 1:
        sosu.add(a)
    #    print(sosu)
    for i in sosu:
        if b % i == 0:
            count += 1
    print(count)


#    for i in range(h):
#            print(aaa)
if __name__ == "__main__":
    main()

-import fractions - +# import fractions -    count = 1 +    count = 0 -    sosu = set() +    sosu = {1} -    if sosu == set() and a != 1: -        sosu.add(a) -    if sosuhante(a) and a != 1: +    if a != 1: