A, B = [int(x) for x in input().split()]

def prime_factorization(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

Aprimes = prime_factorization(A)
Bprimes = set(prime_factorization(B))

ans = 1
ansset = set()
for a in Aprimes:
    if a in ansset:
        continue
    if a in Bprimes:
        ansset.add(a)
        ans += 1

print(ans)
 int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A, B = [int(x) for x in input().split()] A [int(x) for x in input().split()] B def prime_factorization(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors prime_factorization i = 2 i 2 factors = [] factors [] while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
     i * i <= n i * i i i n if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
     n % i n i i += 1 i 1 n //= i n i factors.append(i) factors.append factors append i if n > 1:
        factors.append(n)
     n > 1 n 1 factors.append(n) factors.append factors append n return factors factors n n Aprimes = prime_factorization(A) Aprimes prime_factorization(A) prime_factorization A Bprimes = set(prime_factorization(B)) Bprimes set(prime_factorization(B)) set prime_factorization(B) prime_factorization B ans = 1 ans 1 ansset = set() ansset set() set for a in Aprimes:
    if a in ansset:
        continue
    if a in Bprimes:
        ansset.add(a)
        ans += 1 a Aprimes if a in ansset:
        continue
     a in ansset a ansset continue if a in Bprimes:
        ansset.add(a)
        ans += 1 a in Bprimes a Bprimes ansset.add(a) ansset.add ansset add a ans += 1 ans 1 print(ans) print ans ansset = set() set() ansset Aprimes = prime_factorization(A) prime_factorization(A) Aprimes B = [int(x) for x in input().split()] [int(x) for x in input().split()] B ans += 1 1 ans A, B = [int(x) for x in input().split()] [int(x) for x in input().split()] A ans = 1 1 ans def prime_factorization(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors def prime_factorization(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors prime_factorization Bprimes = set(prime_factorization(B)) set(prime_factorization(B)) Bprimes
A, B = [int(x) for x in input().split()]

def prime_factorization(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

Aprimes = prime_factorization(A)
Bprimes = set(prime_factorization(B))

ans = 1
ansset = set()
for a in Aprimes:
    if a in ansset:
        continue
    if a in Bprimes:
        ansset.add(a)
        ans += 1

print(ans)

