#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)

    m=4

    k=1



    count=1

    sosub=set()

#    a = fractions.gcd(a,b)

    if b%2==0:

        sosub.add(2)

        while b%2==0:

            b//=2

    if b%3==0:

        sosub.add(3)

        while b%3==0:

            b//=3

#    print(d)

    c=math.sqrt(b)+1

 #   print(c)

    while m<=c and m!=1:

        if b%m==0:

            sosub.add(m)

            while b%m==0:

                b//=m



        m+=1

#    print(sosu)

    if sosub==set() and b!=1:

        sosub.add(b)

    if sosuhante(b) and b!=1:

        sosub.add(b)

#    print(sosu,sosub)

    for i in sosu:

        if i in sosub:

            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 = 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)
    m = 4
    k = 1
    count = 1
    sosub = set()
    #    a = fractions.gcd(a,b)
    if b % 2 == 0:
        sosub.add(2)
        while b % 2 == 0:
            b //= 2
    if b % 3 == 0:
        sosub.add(3)
        while b % 3 == 0:
            b //= 3
    #    print(d)
    c = math.sqrt(b) + 1
    #   print(c)
    while m <= c and m != 1:
        if b % m == 0:
            sosub.add(m)
            while b % m == 0:
                b //= m
        m += 1
    #    print(sosu)
    if sosub == set() and b != 1:
        sosub.add(b)
    if sosuhante(b) and b != 1:
        sosub.add(b)
    #    print(sosu,sosub)
    for i in sosu:
        if i in sosub:
            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()

-    m = 4 -    k = 1 -    count = 1 -    sosub = set() -    #    a = fractions.gcd(a,b) -    if b % 2 == 0: -        sosub.add(2) -        while b % 2 == 0: -            b //= 2 -    if b % 3 == 0: -        sosub.add(3) -        while b % 3 == 0: -            b //= 3 -    #    print(d) -    c = math.sqrt(b) + 1 -    #   print(c) -    while m <= c and m != 1: -        if b % m == 0: -            sosub.add(m) -            while b % m == 0: -                b //= m -        m += 1 -    #    print(sosu) -    if sosub == set() and b != 1: -        sosub.add(b) -    if sosuhante(b) and b != 1: -        sosub.add(b) -    #    print(sosu,sosub) -        if i in sosub: +        if b % i == 0: