import sys, re

from collections import deque, defaultdict, Counter

from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2

from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby

from operator import itemgetter, mul

from copy import deepcopy

from string import ascii_lowercase, ascii_uppercase, digits

from bisect import bisect, bisect_left

from fractions import gcd

from heapq import heappush, heappop

from functools import reduce

def input(): return sys.stdin.readline().strip()

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def LIST(): return list(map(int, input().split()))

def ZIP(n): return list(zip(*(MAP() for _ in range(n))))

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

mod = 10 ** 9 + 7



def is_prime(num):

	if num < 2:

		return False

	if num in [2, 3, 5]:

		return True

	if any(num%x == 0 for x in [2, 3, 5]):

		return False

	prime = 7

	step = 4

	while prime <= sqrt(num):

		if num%prime == 0:

			return False

		prime += step

		step = 6-step

	return True





A, B = MAP()



C = gcd(A, B)

ans = 1



for i in range(1, int(sqrt(C))+1):

	if C%i == 0:

		ans += is_prime(i) + is_prime(C//i)



	



print(ans)

import sys, re

from collections import deque, defaultdict, Counter

from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2

from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby

from operator import itemgetter, mul

from copy import deepcopy

from string import ascii_lowercase, ascii_uppercase, digits

from bisect import bisect, bisect_left

from fractions import gcd

from heapq import heappush, heappop

from functools import reduce

def input(): return sys.stdin.readline().strip()

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def LIST(): return list(map(int, input().split()))

def ZIP(n): return list(zip(*(MAP() for _ in range(n))))

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

mod = 10 ** 9 + 7



def factorization(n):

	arr = []

	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

			arr.append([i, cnt])

	if temp != 1:

		arr.append([temp, 1])

	if arr == []:

		arr.append([n, 1])

	return arr



A, B = MAP()

N = gcd(A, B)



print((len(factorization(N))+1 if N != 1 else 1))
import sys, re
from collections import deque, defaultdict, Counter
from math import (
    ceil,
    sqrt,
    hypot,
    factorial,
    pi,
    sin,
    cos,
    tan,
    asin,
    acos,
    atan,
    radians,
    degrees,
    log2,
)
from itertools import (
    accumulate,
    permutations,
    combinations,
    combinations_with_replacement,
    product,
    groupby,
)
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


def input():
    return sys.stdin.readline().strip()


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LIST():
    return list(map(int, input().split()))


def ZIP(n):
    return list(zip(*(MAP() for _ in range(n))))


sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7


def is_prime(num):
    if num < 2:
        return False
    if num in [2, 3, 5]:
        return True
    if any(num % x == 0 for x in [2, 3, 5]):
        return False
    prime = 7
    step = 4
    while prime <= sqrt(num):
        if num % prime == 0:
            return False
        prime += step
        step = 6 - step
    return True


A, B = MAP()
C = gcd(A, B)
ans = 1
for i in range(1, int(sqrt(C)) + 1):
    if C % i == 0:
        ans += is_prime(i) + is_prime(C // i)
print(ans)

import sys, re
from collections import deque, defaultdict, Counter
from math import (
    ceil,
    sqrt,
    hypot,
    factorial,
    pi,
    sin,
    cos,
    tan,
    asin,
    acos,
    atan,
    radians,
    degrees,
    log2,
)
from itertools import (
    accumulate,
    permutations,
    combinations,
    combinations_with_replacement,
    product,
    groupby,
)
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


def input():
    return sys.stdin.readline().strip()


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LIST():
    return list(map(int, input().split()))


def ZIP(n):
    return list(zip(*(MAP() for _ in range(n))))


sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7


def factorization(n):
    arr = []
    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
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr


A, B = MAP()
N = gcd(A, B)
print((len(factorization(N)) + 1 if N != 1 else 1))

-def is_prime(num): -    if num < 2: -        return False -    if num in [2, 3, 5]: -        return True -    if any(num % x == 0 for x in [2, 3, 5]): -        return False -    prime = 7 -    step = 4 -    while prime <= sqrt(num): -        if num % prime == 0: -            return False -        prime += step -        step = 6 - step -    return True +def factorization(n): +    arr = [] +    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 +            arr.append([i, cnt]) +    if temp != 1: +        arr.append([temp, 1]) +    if arr == []: +        arr.append([n, 1]) +    return arr -C = gcd(A, B) -ans = 1 -for i in range(1, int(sqrt(C)) + 1): -    if C % i == 0: -        ans += is_prime(i) + is_prime(C // i) -print(ans) +N = gcd(A, B) +print((len(factorization(N)) + 1 if N != 1 else 1))