from math import gcd
def division(n):
    if n < 2:
        return [1]
    prime_factors = [1]
    for i in range(2,int(n**0.5)+1):
        while n % i == 0:
            prime_factors.append(i)
            n //= i
    if n > 1:
        prime_factors.append(n)
    return prime_factors

a,b = map(int,input().split())
d = set(division(gcd(a,b)))
print(len(d)) from math import gcd def division(n):
    if n < 2:
        return [1]
    prime_factors = [1]
    for i in range(2,int(n**0.5)+1):
        while n % i == 0:
            prime_factors.append(i)
            n //= i
    if n > 1:
        prime_factors.append(n)
    return prime_factors division if n < 2:
        return [1]
     n < 2 n 2 return [1] [1] 1 prime_factors = [1] prime_factors [1] 1 for i in range(2,int(n**0.5)+1):
        while n % i == 0:
            prime_factors.append(i)
            n //= i
     i range(2,int(n**0.5)+1) range 2 int(n**0.5)+1 int(n**0.5) int n**0.5 n 0.5 1 while n % i == 0:
            prime_factors.append(i)
            n //= i
     n % i == 0 n % i n i 0 prime_factors.append(i) prime_factors.append prime_factors append i n //= i n i if n > 1:
        prime_factors.append(n)
     n > 1 n 1 prime_factors.append(n) prime_factors.append prime_factors append n return prime_factors prime_factors n n a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b d = set(division(gcd(a,b))) d set(division(gcd(a,b))) set division(gcd(a,b)) division gcd(a,b) gcd a b print(len(d)) print len(d) len d def division(n):
    if n < 2:
        return [1]
    prime_factors = [1]
    for i in range(2,int(n**0.5)+1):
        while n % i == 0:
            prime_factors.append(i)
            n //= i
    if n > 1:
        prime_factors.append(n)
    return prime_factors def division(n):
    if n < 2:
        return [1]
    prime_factors = [1]
    for i in range(2,int(n**0.5)+1):
        while n % i == 0:
            prime_factors.append(i)
            n //= i
    if n > 1:
        prime_factors.append(n)
    return prime_factors division a,b = map(int,input().split()) map(int,input().split()) a d = set(division(gcd(a,b))) set(division(gcd(a,b))) d b = map(int,input().split()) map(int,input().split()) b
from math import gcd
def division(n):
    if n < 2:
        return [1]
    prime_factors = [1]
    for i in range(2,int(n**0.5)+1):
        while n % i == 0:
            prime_factors.append(i)
            n //= i
    if n > 1:
        prime_factors.append(n)
    return prime_factors

a,b = map(int,input().split())
d = set(division(gcd(a,b)))
print(len(d))