def prime_fact(n):
    primes = []
    i = 2
    while i * i <= n:
        cnt = 0
        while n % i == 0:
            n //= i
            cnt += 1
        if cnt:
            primes.append([i, cnt])
        i += 1

    if n != 1:
        primes.append([n, 1])
    return primes

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

if b < a:
    a, b = b, a

fact = prime_fact(a)
ans = 1
for i, j in fact:
    if b % i == 0:
        ans += 1
if a == 1:
    ans = 1

print(ans) def prime_fact(n):
    primes = []
    i = 2
    while i * i <= n:
        cnt = 0
        while n % i == 0:
            n //= i
            cnt += 1
        if cnt:
            primes.append([i, cnt])
        i += 1

    if n != 1:
        primes.append([n, 1])
    return primes prime_fact primes = [] primes [] i = 2 i 2 while i * i <= n:
        cnt = 0
        while n % i == 0:
            n //= i
            cnt += 1
        if cnt:
            primes.append([i, cnt])
        i += 1

     i * i <= n i * i i i n cnt = 0 cnt 0 while n % i == 0:
            n //= i
            cnt += 1
         n % i == 0 n % i n i 0 n //= i n i cnt += 1 cnt 1 if cnt:
            primes.append([i, cnt])
         cnt primes.append([i, cnt]) primes.append primes append [i, cnt] i cnt i += 1 i 1 if n != 1:
        primes.append([n, 1])
     n != 1 n 1 primes.append([n, 1]) primes.append primes append [n, 1] n 1 return primes primes n n a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b if b < a:
    a, b = b, a b < a b a a, b = b, a a b b a fact = prime_fact(a) fact prime_fact(a) prime_fact a ans = 1 ans 1 for i, j in fact:
    if b % i == 0:
        ans += 1 i j fact if b % i == 0:
        ans += 1 b % i == 0 b % i b i 0 ans += 1 ans 1 if a == 1:
    ans = 1 a == 1 a 1 ans = 1 ans 1 print(ans) print ans b = map(int, input().split()) map(int, input().split()) b fact = prime_fact(a) prime_fact(a) fact a, b = map(int, input().split()) map(int, input().split()) a def prime_fact(n):
    primes = []
    i = 2
    while i * i <= n:
        cnt = 0
        while n % i == 0:
            n //= i
            cnt += 1
        if cnt:
            primes.append([i, cnt])
        i += 1

    if n != 1:
        primes.append([n, 1])
    return primes def prime_fact(n):
    primes = []
    i = 2
    while i * i <= n:
        cnt = 0
        while n % i == 0:
            n //= i
            cnt += 1
        if cnt:
            primes.append([i, cnt])
        i += 1

    if n != 1:
        primes.append([n, 1])
    return primes prime_fact ans = 1 1 ans ans = 1 1 ans b = b, a a b ans += 1 1 ans a, b = b, a b a
def prime_fact(n):
    primes = []
    i = 2
    while i * i <= n:
        cnt = 0
        while n % i == 0:
            n //= i
            cnt += 1
        if cnt:
            primes.append([i, cnt])
        i += 1

    if n != 1:
        primes.append([n, 1])
    return primes

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

if b < a:
    a, b = b, a

fact = prime_fact(a)
ans = 1
for i, j in fact:
    if b % i == 0:
        ans += 1
if a == 1:
    ans = 1

print(ans)