import math
A,B = map(int, input().split())

# 最大公約数の算出
y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp

# 素因数分解
p = []
tmp = int(math.sqrt(x))+1
for n in range(2,tmp):
  while x % n == 0:
    x /= n
    p.append(n)
p.append(int(x))
p.append(1)
p = list(set(p))
print(len(p))
  
   import math math A,B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B y = max(A,B) y max(A,B) max A B x = min(A,B) x min(A,B) min A B while y%x != 0:
  tmp = x
  x = y%x
  y = tmp

# 素因数分解 y%x != 0 y%x y x 0 tmp = x tmp x x = y%x x y%x y x y = tmp y tmp p = [] p [] tmp = int(math.sqrt(x))+1 tmp int(math.sqrt(x))+1 int(math.sqrt(x)) int math.sqrt(x) math.sqrt math sqrt x 1 for n in range(2,tmp):
  while x % n == 0:
    x /= n
    p.append(n) n range(2,tmp) range 2 tmp while x % n == 0:
    x /= n
    p.append(n) x % n == 0 x % n x n 0 x /= n x n p.append(n) p.append p append n p.append(int(x)) p.append p append int(x) int x p.append(1) p.append p append 1 p = list(set(p)) p list(set(p)) list set(p) set p print(len(p)) print len(p) len p x = min(A,B) min(A,B) x x = y%x y%x x p = list(set(p)) list(set(p)) p y = tmp tmp y tmp = int(math.sqrt(x))+1 int(math.sqrt(x))+1 tmp B = map(int, input().split()) map(int, input().split()) B tmp = x x tmp A,B = map(int, input().split()) map(int, input().split()) A x /= n n x y = max(A,B) max(A,B) y p = [] [] p
import math
A,B = map(int, input().split())

# 最大公約数の算出
y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp

# 素因数分解
p = []
tmp = int(math.sqrt(x))+1
for n in range(2,tmp):
  while x % n == 0:
    x /= n
    p.append(n)
p.append(int(x))
p.append(1)
p = list(set(p))
print(len(p))
  
  
