import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C

A,B=mint()
g=gcd(A,B)
print(len(pf(g))+1) import sys sys from sys import exit from collections import deque from bisect import bisect_left, bisect_right, insort_left, insort_right from heapq import heapify, heappop, heappush from itertools import product, permutations, combinations, combinations_with_replacement from functools import reduce from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians sys.setrecursionlimit(10**6) sys.setrecursionlimit sys setrecursionlimit 10**6 10 6 INF = 10**20 INF 10**20 10 20 eps = 1.0e-20 eps 1.0e-20 MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 def lcm(x,y):
    return x*y//gcd(x,y) lcm return x*y//gcd(x,y) x*y//gcd(x,y) x*y x y gcd(x,y) gcd x y x x y y def lgcd(l):
    return reduce(gcd,l) lgcd return reduce(gcd,l) reduce(gcd,l) reduce gcd l l l def llcm(l):
    return reduce(lcm,l) llcm return reduce(lcm,l) reduce(lcm,l) reduce lcm l l l def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod) powmod return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod) pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod) i<0 i 0 pow(n,mod-1+i,mod) pow n mod-1+i mod-1 mod 1 i mod pow(n,i,mod) pow n i mod n n i i mod mod def div2(x):
    return x.bit_length() div2 return x.bit_length() x.bit_length() x.bit_length x bit_length x x def div10(x):
    return len(str(x))-(x==0) div10 return len(str(x))-(x==0) len(str(x))-(x==0) len(str(x)) len str(x) str x x==0 x 0 x x def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans perm ans = 1 ans 1 for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
     i range(1,n+1) range 1 n+1 n 1 ans *= i ans i if mod!=None:
            ans %= mod
     mod!=None mod None ans %= mod ans mod return ans ans n n mod=None mod None def intput():
    return int(input()) intput return int(input()) int(input()) int input() input def mint():
    return map(int,input().split()) mint return map(int,input().split()) map(int,input().split()) map int input().split() ().split () input split def lint():
    return list(map(int,input().split())) lint return list(map(int,input().split())) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split def ilint():
    return int(input()), list(map(int,input().split())) ilint return int(input()), list(map(int,input().split())) return int(input()), list(map(int,input().split())) int(input()) int input() input list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1]) judge print(l[0] if x else l[1]) print l[0] if x else l[1] x l[0] l 0 l[1] l 1 x x l=['Yes', 'No'] l ['Yes', 'No'] 'Yes' 'No' def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep) lprint for x in l:
        print(x, end=sep) x l print(x, end=sep) print x end=sep end sep l l sep='\n' sep '\n' def ston(c, c0='a'):
    return ord(c)-ord(c0) ston return ord(c)-ord(c0) ord(c)-ord(c0) ord(c) ord c ord(c0) ord c0 c c c0='a' c0 'a' def ntos(x, c0='a'):
    return chr(x+ord(c0)) ntos return chr(x+ord(c0)) chr(x+ord(c0)) chr x+ord(c0) x ord(c0) ord c0 x x c0='a' c0 'a' class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d counter def __init__(self, *args):
        super().__init__(args)
     __init__ super().__init__(args) ().__init__ () super __init__ args self self *args def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d add self.setdefault(x,0) self.setdefault self setdefault x 0 self[x] += d self[x] self x d self self x x d=1 d 1 dict class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k] comb def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
     __init__ self.l = [1] self.l self l [1] 1 self.n = n self.n self n n self.mod = mod self.mod self mod mod self self n n mod=None mod None def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k] get l,n,mod = self.l, self.n, self.mod l self.l self l n self.n self n mod self.mod self mod k = n-k if k>n//2 else k k n-k if k>n//2 else k k>n//2 k n//2 n 2 n-k n k k while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
         len(l)<=k len(l) len l k i = len(l) i len(l) len l l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod) l.append l append l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod mod==None mod None l[i-1]*(n+1-i)//i l[i-1]*(n+1-i) l[i-1] l i-1 i 1 n+1-i n+1 n 1 i i (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod l[i-1]*(n+1-i)*powmod(i,-1,mod) l[i-1]*(n+1-i) l[i-1] l i-1 i 1 n+1-i n+1 n 1 i powmod(i,-1,mod) powmod i -1 mod mod return l[k] l[k] l k self self k k def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C pf C = counter() C counter() counter p = 2 p 2 while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
     x>1 x 1 k = 0 k 0 while x%p==0:
            x //= p
            k += 1
         x%p==0 x%p x p 0 x //= p x p k += 1 k 1 if k>0:
            C.add(p,k)
         k>0 k 0 C.add(p,k) C.add C add p k p = p+2-(p==2) if p*p<x else x p p+2-(p==2) if p*p<x else x p*p<x p*p p p x p+2-(p==2) p+2 p 2 p==2 p 2 x return C C x x A,B=mint() A mint() mint B g=gcd(A,B) g gcd(A,B) gcd A B print(len(pf(g))+1) print len(pf(g))+1 len(pf(g)) len pf(g) pf g 1 def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans perm def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod) def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod) powmod def lcm(x,y):
    return x*y//gcd(x,y) def lcm(x,y):
    return x*y//gcd(x,y) lcm def llcm(l):
    return reduce(lcm,l) def llcm(l):
    return reduce(lcm,l) llcm def div2(x):
    return x.bit_length() def div2(x):
    return x.bit_length() div2 def lgcd(l):
    return reduce(gcd,l) def lgcd(l):
    return reduce(gcd,l) lgcd def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep) def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep) lprint def ston(c, c0='a'):
    return ord(c)-ord(c0) def ston(c, c0='a'):
    return ord(c)-ord(c0) ston class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k] class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k] comb def lint():
    return list(map(int,input().split())) def lint():
    return list(map(int,input().split())) lint A,B=mint() mint() A g=gcd(A,B) gcd(A,B) g def intput():
    return int(input()) def intput():
    return int(input()) intput def div10(x):
    return len(str(x))-(x==0) def div10(x):
    return len(str(x))-(x==0) div10 def mint():
    return map(int,input().split()) def mint():
    return map(int,input().split()) mint class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d counter def ilint():
    return int(input()), list(map(int,input().split())) def ilint():
    return int(input()), list(map(int,input().split())) ilint eps = 1.0e-20 1.0e-20 eps def ntos(x, c0='a'):
    return chr(x+ord(c0)) def ntos(x, c0='a'):
    return chr(x+ord(c0)) ntos INF = 10**20 10**20 INF def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1]) def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1]) judge def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C pf B=mint() mint() B MOD = 10**9+7 10**9+7 MOD
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C

A,B=mint()
g=gcd(A,B)
print(len(pf(g))+1)