
import math

# 試し割法により素因数分解
# https://note.nkmk.me/python-prime-factorization/
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def main():
    A, B = map(int,input().split())
    G = math.gcd(A, B)
    primes = prime_factorize(G)
    print(1 + len(set(primes)))

if __name__ == "__main__":
    main() import math math def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a prime_factorize a = [] a [] while n % 2 == 0:
        a.append(2)
        n //= 2
     n % 2 == 0 n % 2 n 2 0 a.append(2) a.append a append 2 n //= 2 n 2 f = 3 f 3 while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
     f * f <= n f * f f f n if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
     n % f == 0 n % f n f 0 a.append(f) a.append a append f n //= f n f f += 2 f 2 if n != 1:
        a.append(n)
     n != 1 n 1 a.append(n) a.append a append n return a a n n def main():
    A, B = map(int,input().split())
    G = math.gcd(A, B)
    primes = prime_factorize(G)
    print(1 + len(set(primes))) main 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 primes = prime_factorize(G) primes prime_factorize(G) prime_factorize G print(1 + len(set(primes))) print 1 + len(set(primes)) 1 len(set(primes)) len set(primes) set primes if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a prime_factorize def main():
    A, B = map(int,input().split())
    G = math.gcd(A, B)
    primes = prime_factorize(G)
    print(1 + len(set(primes))) def main():
    A, B = map(int,input().split())
    G = math.gcd(A, B)
    primes = prime_factorize(G)
    print(1 + len(set(primes))) main

import math

# 試し割法により素因数分解
# https://note.nkmk.me/python-prime-factorization/
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def main():
    A, B = map(int,input().split())
    G = math.gcd(A, B)
    primes = prime_factorize(G)
    print(1 + len(set(primes)))

if __name__ == "__main__":
    main()
