def factorize(N):  # 素因数分解
    p, PRIME = 2, set()
    while p * p <= N:
        if N % p == 0:
            N //= p
            PRIME.add(p)
        else:
            p += 1
    if N > 1:
        PRIME.add(N)
    return PRIME


a, b = map(int, input().split())

ans = factorize(a) & factorize(b)
print(len(ans) + 1) def factorize(N):  # 素因数分解
    p, PRIME = 2, set()
    while p * p <= N:
        if N % p == 0:
            N //= p
            PRIME.add(p)
        else:
            p += 1
    if N > 1:
        PRIME.add(N)
    return PRIME factorize p, PRIME = 2, set() p 2 PRIME set() set while p * p <= N:
        if N % p == 0:
            N //= p
            PRIME.add(p)
        else:
            p += 1
     p * p <= N p * p p p N if N % p == 0:
            N //= p
            PRIME.add(p)
        else:
            p += 1
     N % p == 0 N % p N p 0 N //= p N p PRIME.add(p) PRIME.add PRIME add p p += 1 p 1 if N > 1:
        PRIME.add(N)
     N > 1 N 1 PRIME.add(N) PRIME.add PRIME add N return PRIME PRIME N N a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b ans = factorize(a) & factorize(b) ans factorize(a) & factorize(b) factorize(a) factorize a factorize(b) factorize b print(len(ans) + 1) print len(ans) + 1 len(ans) len ans 1 a, b = map(int, input().split()) map(int, input().split()) a ans = factorize(a) & factorize(b) factorize(a) & factorize(b) ans b = map(int, input().split()) map(int, input().split()) b def factorize(N):  # 素因数分解
    p, PRIME = 2, set()
    while p * p <= N:
        if N % p == 0:
            N //= p
            PRIME.add(p)
        else:
            p += 1
    if N > 1:
        PRIME.add(N)
    return PRIME def factorize(N):  # 素因数分解
    p, PRIME = 2, set()
    while p * p <= N:
        if N % p == 0:
            N //= p
            PRIME.add(p)
        else:
            p += 1
    if N > 1:
        PRIME.add(N)
    return PRIME factorize
def factorize(N):  # 素因数分解
    p, PRIME = 2, set()
    while p * p <= N:
        if N % p == 0:
            N //= p
            PRIME.add(p)
        else:
            p += 1
    if N > 1:
        PRIME.add(N)
    return PRIME


a, b = map(int, input().split())

ans = factorize(a) & factorize(b)
print(len(ans) + 1)
