import sys

from fractions import gcd

def input():

    return sys.stdin.readline()[:-1]

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

tmp=gcd(a,b)

# print(tmp)

def factorization(n):

    arr = []

    temp = n

    for i in range(2, int(-(-n**0.5//1))+1):

        if temp%i==0:

            cnt=0

            while temp%i==0:

                cnt+=1

                temp //= i

            arr.append([i, cnt])



    if temp!=1:

        arr.append([temp, 1])



    if arr==[]:

        arr.append([n, 1])



    return arr



ans=factorization(tmp)

# print(ans)

if tmp==1:

    print((1))

else:

    print((len(ans)+1))
import bisect, copy, heapq, math

import sys

from collections import *

from functools import lru_cache

from itertools import accumulate, combinations, permutations, product

def input():

    return sys.stdin.readline()[:-1]

def ruiseki(lst):

    return [0]+list(accumulate(lst))

sys.setrecursionlimit(5000000)

mod=pow(10,9)+7

al=[chr(ord('a') + i) for i in range(26)]

direction=[[1,0],[0,1],[-1,0],[0,-1]]



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

g=math.gcd(a,b)



def factorization(n):

    arr = []

    temp = n

    for i in range(2, int(-(-n**0.5//1))+1):

        if temp%i==0:

            cnt=0

            while temp%i==0:

                cnt+=1

                temp //= i

            arr.append([i, cnt])

    if temp!=1:

        arr.append([temp, 1])

    if arr==[]:

        arr.append([n, 1])

    return arr



if g==1:

    print((1))

else:

    print((len(factorization(g))+1))
import sys
from fractions import gcd


def input():
    return sys.stdin.readline()[:-1]


a, b = list(map(int, input().split()))
tmp = gcd(a, b)
# print(tmp)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-(n**0.5) // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr


ans = factorization(tmp)
# print(ans)
if tmp == 1:
    print((1))
else:
    print((len(ans) + 1))

import bisect, copy, heapq, math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product


def input():
    return sys.stdin.readline()[:-1]


def ruiseki(lst):
    return [0] + list(accumulate(lst))


sys.setrecursionlimit(5000000)
mod = pow(10, 9) + 7
al = [chr(ord("a") + i) for i in range(26)]
direction = [[1, 0], [0, 1], [-1, 0], [0, -1]]
a, b = list(map(int, input().split()))
g = math.gcd(a, b)


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-(n**0.5) // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr


if g == 1:
    print((1))
else:
    print((len(factorization(g)) + 1))

+import bisect, copy, heapq, math -from fractions import gcd +from collections import * +from functools import lru_cache +from itertools import accumulate, combinations, permutations, product +def ruiseki(lst): +    return [0] + list(accumulate(lst)) + + +sys.setrecursionlimit(5000000) +mod = pow(10, 9) + 7 +al = [chr(ord("a") + i) for i in range(26)] +direction = [[1, 0], [0, 1], [-1, 0], [0, -1]] -tmp = gcd(a, b) -# print(tmp) +g = math.gcd(a, b) + + -ans = factorization(tmp) -# print(ans) -if tmp == 1: +if g == 1: -    print((len(ans) + 1)) +    print((len(factorization(g)) + 1))