def prime_factorize(n):
    # 素因数分解して素数と1の集合を作る
    a = {1}
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a


A, B = map(int, input().split())
cds = prime_factorize(A) & prime_factorize(B)
print(len(cds)) def prime_factorize(n):
    # 素因数分解して素数と1の集合を作る
    a = {1}
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a prime_factorize a = {1} a {1} while n % 2 == 0:
        a.add(2)
        n //= 2
     n % 2 == 0 n % 2 n 2 0 a.add(2) a.add a add 2 n //= 2 n 2 f = 3 f 3 while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
     f * f <= n f * f f f n if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
     n % f == 0 n % f n f 0 a.add(f) a.add a add f n //= f n f f += 2 f 2 if n != 1:
        a.add(n)
     n != 1 n 1 a.add(n) a.add a add n return a a n n A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B cds = prime_factorize(A) & prime_factorize(B) cds prime_factorize(A) & prime_factorize(B) prime_factorize(A) prime_factorize A prime_factorize(B) prime_factorize B print(len(cds)) print len(cds) len cds cds = prime_factorize(A) & prime_factorize(B) prime_factorize(A) & prime_factorize(B) cds A, B = map(int, input().split()) map(int, input().split()) A B = map(int, input().split()) map(int, input().split()) B def prime_factorize(n):
    # 素因数分解して素数と1の集合を作る
    a = {1}
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a def prime_factorize(n):
    # 素因数分解して素数と1の集合を作る
    a = {1}
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a prime_factorize
def prime_factorize(n):
    # 素因数分解して素数と1の集合を作る
    a = {1}
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a


A, B = map(int, input().split())
cds = prime_factorize(A) & prime_factorize(B)
print(len(cds))