import math
A, B = map(int, input().split())
gcd = math.gcd(A, B)
ans = [1]
while gcd % 2 == 0:
  ans.append(2)
  gcd = gcd // 2
f = 3
while f * f <= gcd:
  if gcd % f == 0:
    ans.append(f)
    gcd = gcd // f
  else:
    f += 2
if gcd != 1:
  ans.append(gcd)
print(len(set(ans))) import math math A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B gcd = math.gcd(A, B) gcd math.gcd(A, B) math.gcd math gcd A B ans = [1] ans [1] 1 while gcd % 2 == 0:
  ans.append(2)
  gcd = gcd // 2 gcd % 2 == 0 gcd % 2 gcd 2 0 ans.append(2) ans.append ans append 2 gcd = gcd // 2 gcd gcd // 2 gcd 2 f = 3 f 3 while f * f <= gcd:
  if gcd % f == 0:
    ans.append(f)
    gcd = gcd // f
  else:
    f += 2 f * f <= gcd f * f f f gcd if gcd % f == 0:
    ans.append(f)
    gcd = gcd // f
  else:
    f += 2 gcd % f == 0 gcd % f gcd f 0 ans.append(f) ans.append ans append f gcd = gcd // f gcd gcd // f gcd f f += 2 f 2 if gcd != 1:
  ans.append(gcd) gcd != 1 gcd 1 ans.append(gcd) ans.append ans append gcd print(len(set(ans))) print len(set(ans)) len set(ans) set ans ans = [1] [1] ans A, B = map(int, input().split()) map(int, input().split()) A gcd = gcd // f gcd // f gcd f += 2 2 f B = map(int, input().split()) map(int, input().split()) B gcd = math.gcd(A, B) math.gcd(A, B) gcd f = 3 3 f gcd = gcd // 2 gcd // 2 gcd
import math
A, B = map(int, input().split())
gcd = math.gcd(A, B)
ans = [1]
while gcd % 2 == 0:
  ans.append(2)
  gcd = gcd // 2
f = 3
while f * f <= gcd:
  if gcd % f == 0:
    ans.append(f)
    gcd = gcd // f
  else:
    f += 2
if gcd != 1:
  ans.append(gcd)
print(len(set(ans)))