#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
# def yaku(m):
#         ans = []
#         i = 1
#         while i*i <= m:
#             if m % i == 0:
#                 j = m // i
#                 ans.append(i)
#                 if j != i:
#                     ans.append(j)
#             i += 1
#         ans = sorted(ans)
#         return ans
a,b = readInts()
# print(yaku(a))
# print(yaku(b))
g = gcd(a,b)
# print(g)
# print(yaku(g))
def soinsu(n):
    dic = defaultdict(int)
    i = 2
    while i*i <= n:
        if n%i == 0:
            dic[i] += 1
            n //= i
        else:
            i += 1
    if n!= 1:
        dic[n] += 1
    return dic
dic = soinsu(g)
cnt = 1 # 1
for k,v in dic.items():
    cnt += 1
print(cnt)
# a //= g
# b //= g
# print(a,b) from fractions import gcd from itertools import combinations,permutations from collections import deque,defaultdict import sys sys sys.setrecursionlimit(10000000) sys.setrecursionlimit sys setrecursionlimit 10000000 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 def readInts():
  return list(map(int,input().split())) readInts return list(map(int,input().split())) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split def I():
  return int(input())
# def yaku(m):
#         ans = []
#         i = 1
#         while i*i <= m:
#             if m % i == 0:
#                 j = m // i
#                 ans.append(i)
#                 if j != i:
#                     ans.append(j)
#             i += 1
#         ans = sorted(ans)
#         return ans I return int(input()) int(input()) int input() input a,b = readInts() a readInts() readInts b g = gcd(a,b) g gcd(a,b) gcd a b def soinsu(n):
    dic = defaultdict(int)
    i = 2
    while i*i <= n:
        if n%i == 0:
            dic[i] += 1
            n //= i
        else:
            i += 1
    if n!= 1:
        dic[n] += 1
    return dic soinsu dic = defaultdict(int) dic defaultdict(int) defaultdict int i = 2 i 2 while i*i <= n:
        if n%i == 0:
            dic[i] += 1
            n //= i
        else:
            i += 1
     i*i <= n i*i i i n if n%i == 0:
            dic[i] += 1
            n //= i
        else:
            i += 1
     n%i == 0 n%i n i 0 dic[i] += 1 dic[i] dic i 1 n //= i n i i += 1 i 1 if n!= 1:
        dic[n] += 1
     n!= 1 n 1 dic[n] += 1 dic[n] dic n 1 return dic dic n n dic = soinsu(g) dic soinsu(g) soinsu g cnt = 1 cnt 1 for k,v in dic.items():
    cnt += 1 k v dic.items() dic.items dic items cnt += 1 cnt 1 print(cnt) print cnt cnt += 1 1 cnt def soinsu(n):
    dic = defaultdict(int)
    i = 2
    while i*i <= n:
        if n%i == 0:
            dic[i] += 1
            n //= i
        else:
            i += 1
    if n!= 1:
        dic[n] += 1
    return dic def soinsu(n):
    dic = defaultdict(int)
    i = 2
    while i*i <= n:
        if n%i == 0:
            dic[i] += 1
            n //= i
        else:
            i += 1
    if n!= 1:
        dic[n] += 1
    return dic soinsu def I():
  return int(input())
# def yaku(m):
#         ans = []
#         i = 1
#         while i*i <= m:
#             if m % i == 0:
#                 j = m // i
#                 ans.append(i)
#                 if j != i:
#                     ans.append(j)
#             i += 1
#         ans = sorted(ans)
#         return ans def I():
  return int(input())
# def yaku(m):
#         ans = []
#         i = 1
#         while i*i <= m:
#             if m % i == 0:
#                 j = m // i
#                 ans.append(i)
#                 if j != i:
#                     ans.append(j)
#             i += 1
#         ans = sorted(ans)
#         return ans I a,b = readInts() readInts() a mod = 10**9 + 7 10**9 + 7 mod def readInts():
  return list(map(int,input().split())) def readInts():
  return list(map(int,input().split())) readInts b = readInts() readInts() b g = gcd(a,b) gcd(a,b) g cnt = 1 1 cnt dic = soinsu(g) soinsu(g) dic
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
# def yaku(m):
#         ans = []
#         i = 1
#         while i*i <= m:
#             if m % i == 0:
#                 j = m // i
#                 ans.append(i)
#                 if j != i:
#                     ans.append(j)
#             i += 1
#         ans = sorted(ans)
#         return ans
a,b = readInts()
# print(yaku(a))
# print(yaku(b))
g = gcd(a,b)
# print(g)
# print(yaku(g))
def soinsu(n):
    dic = defaultdict(int)
    i = 2
    while i*i <= n:
        if n%i == 0:
            dic[i] += 1
            n //= i
        else:
            i += 1
    if n!= 1:
        dic[n] += 1
    return dic
dic = soinsu(g)
cnt = 1 # 1
for k,v in dic.items():
    cnt += 1
print(cnt)
# a //= g
# b //= g
# print(a,b)
