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

arr = []#素数リスト　(素数:べき)の形で出てくる

def factorization(n):
    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])

factorization(a)
ans = 0

for p,n in arr:
  if b%p == 0:
    ans += 1
    
if len(arr) == 1 and arr[0][0] == 1:
  print(1)
  exit()
  
print(ans+1) a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b arr = [] arr [] def factorization(n):
    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]) factorization temp = n 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])

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

     temp%i==0 temp%i temp i 0 cnt=0 cnt 0 while temp%i==0:
                cnt+=1
                temp //= i
             temp%i==0 temp%i temp i 0 cnt+=1 cnt 1 temp //= i temp i arr.append([i, cnt]) arr.append arr append [i, cnt] i cnt if temp!=1:
        arr.append([temp, 1])

     temp!=1 temp 1 arr.append([temp, 1]) arr.append arr append [temp, 1] temp 1 if arr==[]:
        arr.append([n, 1]) arr==[] arr [] arr.append([n, 1]) arr.append arr append [n, 1] n 1 n n factorization(a) factorization a ans = 0 ans 0 for p,n in arr:
  if b%p == 0:
    ans += 1
     p n arr if b%p == 0:
    ans += 1
     b%p == 0 b%p b p 0 ans += 1 ans 1 if len(arr) == 1 and arr[0][0] == 1:
  print(1)
  exit()
   len(arr) == 1 and arr[0][0] == 1 len(arr) == 1 len(arr) len arr 1 arr[0][0] == 1 arr[0][0] [0] arr 0 0 1 print(1) print 1 exit() exit print(ans+1) print ans+1 ans 1 arr = [] [] arr b = map(int,input().split()) map(int,input().split()) b ans += 1 1 ans a,b = map(int,input().split()) map(int,input().split()) a ans = 0 0 ans def factorization(n):
    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]) def factorization(n):
    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]) factorization
a,b = map(int,input().split())

arr = []#素数リスト　(素数:べき)の形で出てくる

def factorization(n):
    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])

factorization(a)
ans = 0

for p,n in arr:
  if b%p == 0:
    ans += 1
    
if len(arr) == 1 and arr[0][0] == 1:
  print(1)
  exit()
  
print(ans+1)