import math
def prime(g):
    l = []
    p = 2
    while p * p <= g:
        if g % p != 0:
            p += 1
            continue
        while g % p == 0:
            g //= p
        l.append(p)
        p += 1
    if g != 1:
        l.append(g)
    return len(l)

a, b = map(int, input().split())
g = math.gcd(a, b)
print(prime(g) + 1) import math math def prime(g):
    l = []
    p = 2
    while p * p <= g:
        if g % p != 0:
            p += 1
            continue
        while g % p == 0:
            g //= p
        l.append(p)
        p += 1
    if g != 1:
        l.append(g)
    return len(l) prime l = [] l [] p = 2 p 2 while p * p <= g:
        if g % p != 0:
            p += 1
            continue
        while g % p == 0:
            g //= p
        l.append(p)
        p += 1
     p * p <= g p * p p p g if g % p != 0:
            p += 1
            continue
         g % p != 0 g % p g p 0 p += 1 p 1 continue while g % p == 0:
            g //= p
         g % p == 0 g % p g p 0 g //= p g p l.append(p) l.append l append p p += 1 p 1 if g != 1:
        l.append(g)
     g != 1 g 1 l.append(g) l.append l append g return len(l) len(l) len l g g a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b g = math.gcd(a, b) g math.gcd(a, b) math.gcd math gcd a b print(prime(g) + 1) print prime(g) + 1 prime(g) prime g 1 def prime(g):
    l = []
    p = 2
    while p * p <= g:
        if g % p != 0:
            p += 1
            continue
        while g % p == 0:
            g //= p
        l.append(p)
        p += 1
    if g != 1:
        l.append(g)
    return len(l) def prime(g):
    l = []
    p = 2
    while p * p <= g:
        if g % p != 0:
            p += 1
            continue
        while g % p == 0:
            g //= p
        l.append(p)
        p += 1
    if g != 1:
        l.append(g)
    return len(l) prime g = math.gcd(a, b) math.gcd(a, b) g a, b = map(int, input().split()) map(int, input().split()) a b = map(int, input().split()) map(int, input().split()) b
import math
def prime(g):
    l = []
    p = 2
    while p * p <= g:
        if g % p != 0:
            p += 1
            continue
        while g % p == 0:
            g //= p
        l.append(p)
        p += 1
    if g != 1:
        l.append(g)
    return len(l)

a, b = map(int, input().split())
g = math.gcd(a, b)
print(prime(g) + 1)
