from math import gcd

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

d = gcd(A, B)
ans = 1
i = 2
while i <= pow(d, 1/2)+1:
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
ans += (d > 1)
print(ans) from math import gcd A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B d = gcd(A, B) d gcd(A, B) gcd A B ans = 1 ans 1 i = 2 i 2 while i <= pow(d, 1/2)+1:
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1 i <= pow(d, 1/2)+1 i pow(d, 1/2)+1 pow(d, 1/2) pow d 1/2 1 2 1 if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
   d%i == 0 d%i d i 0 ans += 1 ans 1 while d%i == 0:
      d //= i
   d%i == 0 d%i d i 0 d //= i d i i += 1 i 1 ans += (d > 1) ans d > 1 d 1 print(ans) print ans ans = 1 1 ans ans += (d > 1) d > 1 ans ans += 1 1 ans i += 1 1 i d = gcd(A, B) gcd(A, B) d d //= i i d B = map(int, input().split()) map(int, input().split()) B A, B = map(int, input().split()) map(int, input().split()) A i = 2 2 i
from math import gcd

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

d = gcd(A, B)
ans = 1
i = 2
while i <= pow(d, 1/2)+1:
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
ans += (d > 1)
print(ans)