A, B = map(int, input().split())

from collections import defaultdict
def factorization(n):
    d = defaultdict(int)
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            d[i] = cnt
    if temp != 1:
        d[temp] = 1
    if len(d) == 0:
        d[n] = 1
    return d
ans = 0
d = factorization(A)
d[1] = 1
for x in d.keys():
    if B%x == 0:
        ans += 1
print(ans) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B from collections import defaultdict def factorization(n):
    d = defaultdict(int)
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            d[i] = cnt
    if temp != 1:
        d[temp] = 1
    if len(d) == 0:
        d[n] = 1
    return d factorization d = defaultdict(int) d defaultdict(int) defaultdict int temp = n temp n for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            d[i] = cnt
     i range(2, int(-(-n**0.5//1))+1) range 2 int(-(-n**0.5//1))+1 int(-(-n**0.5//1)) int -(-n**0.5//1) -n**0.5//1 -n**0.5 n**0.5 n 0.5 1 1 if temp%i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            d[i] = cnt
     temp%i == 0 temp%i temp i 0 cnt = 0 cnt 0 while temp % i == 0:
                cnt += 1
                temp //= i
             temp % i == 0 temp % i temp i 0 cnt += 1 cnt 1 temp //= i temp i d[i] = cnt d[i] d i cnt if temp != 1:
        d[temp] = 1
     temp != 1 temp 1 d[temp] = 1 d[temp] d temp 1 if len(d) == 0:
        d[n] = 1
     len(d) == 0 len(d) len d 0 d[n] = 1 d[n] d n 1 return d d n n ans = 0 ans 0 d = factorization(A) d factorization(A) factorization A d[1] = 1 d[1] d 1 1 for x in d.keys():
    if B%x == 0:
        ans += 1 x d.keys() d.keys d keys if B%x == 0:
        ans += 1 B%x == 0 B%x B x 0 ans += 1 ans 1 print(ans) print ans ans = 0 0 ans def factorization(n):
    d = defaultdict(int)
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            d[i] = cnt
    if temp != 1:
        d[temp] = 1
    if len(d) == 0:
        d[n] = 1
    return d def factorization(n):
    d = defaultdict(int)
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            d[i] = cnt
    if temp != 1:
        d[temp] = 1
    if len(d) == 0:
        d[n] = 1
    return d factorization A, B = map(int, input().split()) map(int, input().split()) A B = map(int, input().split()) map(int, input().split()) B d = factorization(A) factorization(A) d ans += 1 1 ans
A, B = map(int, input().split())

from collections import defaultdict
def factorization(n):
    d = defaultdict(int)
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            d[i] = cnt
    if temp != 1:
        d[temp] = 1
    if len(d) == 0:
        d[n] = 1
    return d
ans = 0
d = factorization(A)
d[1] = 1
for x in d.keys():
    if B%x == 0:
        ans += 1
print(ans)