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

def factorize(n):
    factor = []
    if n % 2 == 0:
        f = [2, 1]
        n //= 2
        while n % 2 == 0:
            n //= 2
            f[1] += 1
        factor.append(f)

    k = 3
    while k * k <= n:
        if n % k == 0:
            f = [k, 1]
            n //= k
            while n % k == 0:
                n //= k
                f[1] += 1
            factor.append(f)
        k += 2
    if n != 1:
        factor.append([n, 1])
    return factor

a, b = map(int, input().split())
c = gcd(a, b)
f = factorize(c)
print(len(f) + 1) def gcd(a, b):
    if a < b:
        return gcd(b, a)
    while b > 0:
        a, b = b, a % b
    return a gcd if a < b:
        return gcd(b, a)
     a < b a b return gcd(b, a) gcd(b, a) gcd b a while b > 0:
        a, b = b, a % b
     b > 0 b 0 a, b = b, a % b a b b a % b a b return a a a a b b def factorize(n):
    factor = []
    if n % 2 == 0:
        f = [2, 1]
        n //= 2
        while n % 2 == 0:
            n //= 2
            f[1] += 1
        factor.append(f)

    k = 3
    while k * k <= n:
        if n % k == 0:
            f = [k, 1]
            n //= k
            while n % k == 0:
                n //= k
                f[1] += 1
            factor.append(f)
        k += 2
    if n != 1:
        factor.append([n, 1])
    return factor factorize factor = [] factor [] if n % 2 == 0:
        f = [2, 1]
        n //= 2
        while n % 2 == 0:
            n //= 2
            f[1] += 1
        factor.append(f)

     n % 2 == 0 n % 2 n 2 0 f = [2, 1] f [2, 1] 2 1 n //= 2 n 2 while n % 2 == 0:
            n //= 2
            f[1] += 1
         n % 2 == 0 n % 2 n 2 0 n //= 2 n 2 f[1] += 1 f[1] f 1 1 factor.append(f) factor.append factor append f k = 3 k 3 while k * k <= n:
        if n % k == 0:
            f = [k, 1]
            n //= k
            while n % k == 0:
                n //= k
                f[1] += 1
            factor.append(f)
        k += 2
     k * k <= n k * k k k n if n % k == 0:
            f = [k, 1]
            n //= k
            while n % k == 0:
                n //= k
                f[1] += 1
            factor.append(f)
         n % k == 0 n % k n k 0 f = [k, 1] f [k, 1] k 1 n //= k n k while n % k == 0:
                n //= k
                f[1] += 1
             n % k == 0 n % k n k 0 n //= k n k f[1] += 1 f[1] f 1 1 factor.append(f) factor.append factor append f k += 2 k 2 if n != 1:
        factor.append([n, 1])
     n != 1 n 1 factor.append([n, 1]) factor.append factor append [n, 1] n 1 return factor factor n n a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b c = gcd(a, b) c gcd(a, b) gcd a b f = factorize(c) f factorize(c) factorize c print(len(f) + 1) print len(f) + 1 len(f) len f 1 def factorize(n):
    factor = []
    if n % 2 == 0:
        f = [2, 1]
        n //= 2
        while n % 2 == 0:
            n //= 2
            f[1] += 1
        factor.append(f)

    k = 3
    while k * k <= n:
        if n % k == 0:
            f = [k, 1]
            n //= k
            while n % k == 0:
                n //= k
                f[1] += 1
            factor.append(f)
        k += 2
    if n != 1:
        factor.append([n, 1])
    return factor def factorize(n):
    factor = []
    if n % 2 == 0:
        f = [2, 1]
        n //= 2
        while n % 2 == 0:
            n //= 2
            f[1] += 1
        factor.append(f)

    k = 3
    while k * k <= n:
        if n % k == 0:
            f = [k, 1]
            n //= k
            while n % k == 0:
                n //= k
                f[1] += 1
            factor.append(f)
        k += 2
    if n != 1:
        factor.append([n, 1])
    return factor factorize b = map(int, input().split()) map(int, input().split()) b c = gcd(a, b) gcd(a, b) c def gcd(a, b):
    if a < b:
        return gcd(b, a)
    while b > 0:
        a, b = b, a % b
    return a def gcd(a, b):
    if a < b:
        return gcd(b, a)
    while b > 0:
        a, b = b, a % b
    return a gcd a, b = map(int, input().split()) map(int, input().split()) a f = factorize(c) factorize(c) f
def gcd(a, b):
    if a < b:
        return gcd(b, a)
    while b > 0:
        a, b = b, a % b
    return a

def factorize(n):
    factor = []
    if n % 2 == 0:
        f = [2, 1]
        n //= 2
        while n % 2 == 0:
            n //= 2
            f[1] += 1
        factor.append(f)

    k = 3
    while k * k <= n:
        if n % k == 0:
            f = [k, 1]
            n //= k
            while n % k == 0:
                n //= k
                f[1] += 1
            factor.append(f)
        k += 2
    if n != 1:
        factor.append([n, 1])
    return factor

a, b = map(int, input().split())
c = gcd(a, b)
f = factorize(c)
print(len(f) + 1)
