def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def prime_fact(g):
    s = {1}
    i = 2
    # N=p x qとした時、(p < q)
    # 必ず p <= root(N)
    # そのためp**2までを調べればok
    while i*i <= g:
        while g % i == 0:
            g //= i
            s.add(i)
        i += 1
    s.add(g)
    return s


a, b = map(int, input().split())
G = gcd(a, b)
print(len(prime_fact(G))) def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b) gcd if b == 0:
        return a
     b == 0 b 0 return a a return gcd(b, a % b) gcd(b, a % b) gcd b a % b a b a a b b def prime_fact(g):
    s = {1}
    i = 2
    # N=p x qとした時、(p < q)
    # 必ず p <= root(N)
    # そのためp**2までを調べればok
    while i*i <= g:
        while g % i == 0:
            g //= i
            s.add(i)
        i += 1
    s.add(g)
    return s prime_fact s = {1} s {1} i = 2 i 2 while i*i <= g:
        while g % i == 0:
            g //= i
            s.add(i)
        i += 1
     i*i <= g i*i i i g while g % i == 0:
            g //= i
            s.add(i)
         g % i == 0 g % i g i 0 g //= i g i s.add(i) s.add s add i i += 1 i 1 s.add(g) s.add s add g return s s g g a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b G = gcd(a, b) G gcd(a, b) gcd a b print(len(prime_fact(G))) print len(prime_fact(G)) len prime_fact(G) prime_fact G a, b = map(int, input().split()) map(int, input().split()) a def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b) def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b) gcd b = map(int, input().split()) map(int, input().split()) b G = gcd(a, b) gcd(a, b) G def prime_fact(g):
    s = {1}
    i = 2
    # N=p x qとした時、(p < q)
    # 必ず p <= root(N)
    # そのためp**2までを調べればok
    while i*i <= g:
        while g % i == 0:
            g //= i
            s.add(i)
        i += 1
    s.add(g)
    return s def prime_fact(g):
    s = {1}
    i = 2
    # N=p x qとした時、(p < q)
    # 必ず p <= root(N)
    # そのためp**2までを調べればok
    while i*i <= g:
        while g % i == 0:
            g //= i
            s.add(i)
        i += 1
    s.add(g)
    return s prime_fact
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def prime_fact(g):
    s = {1}
    i = 2
    # N=p x qとした時、(p < q)
    # 必ず p <= root(N)
    # そのためp**2までを調べればok
    while i*i <= g:
        while g % i == 0:
            g //= i
            s.add(i)
        i += 1
    s.add(g)
    return s


a, b = map(int, input().split())
G = gcd(a, b)
print(len(prime_fact(G)))
