from math import gcd
a, b = map(int, input().split())

def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n //i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

v = gcd(a,b) # greatest common divisors
divs = make_divisors(v)

k = 1
ans = 0
for d in divs:
    test = gcd(k, d)
    if test == 1:
        ans += 1
        k *= d
print(ans) from math import gcd a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n //i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1] make_divisors lower_divisors, upper_divisors = [], [] lower_divisors [] upper_divisors [] i = 1 i 1 while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n //i:
                upper_divisors.append(n//i)
        i += 1
     i*i <= n i*i i i n if n % i == 0:
            lower_divisors.append(i)
            if i != n //i:
                upper_divisors.append(n//i)
         n % i == 0 n % i n i 0 lower_divisors.append(i) lower_divisors.append lower_divisors append i if i != n //i:
                upper_divisors.append(n//i)
         i != n //i i n //i n i upper_divisors.append(n//i) upper_divisors.append upper_divisors append n//i n i i += 1 i 1 return lower_divisors + upper_divisors[::-1] lower_divisors + upper_divisors[::-1] lower_divisors upper_divisors[::-1] upper_divisors ::-1 -1 n n v = gcd(a,b) v gcd(a,b) gcd a b divs = make_divisors(v) divs make_divisors(v) make_divisors v k = 1 k 1 ans = 0 ans 0 for d in divs:
    test = gcd(k, d)
    if test == 1:
        ans += 1
        k *= d d divs test = gcd(k, d) test gcd(k, d) gcd k d if test == 1:
        ans += 1
        k *= d test == 1 test 1 ans += 1 ans 1 k *= d k d print(ans) print ans def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n //i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1] def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n //i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1] make_divisors ans = 0 0 ans divs = make_divisors(v) make_divisors(v) divs b = map(int, input().split()) map(int, input().split()) b test = gcd(k, d) gcd(k, d) test k = 1 1 k k *= d d k v = gcd(a,b) gcd(a,b) v ans += 1 1 ans a, b = map(int, input().split()) map(int, input().split()) a
from math import gcd
a, b = map(int, input().split())

def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n //i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

v = gcd(a,b) # greatest common divisors
divs = make_divisors(v)

k = 1
ans = 0
for d in divs:
    test = gcd(k, d)
    if test == 1:
        ans += 1
        k *= d
print(ans)
