import fractions, math



def make_divisors(n):

    divisors = []

    for i in range(1, int(n**0.5)+1):

        if n % i == 0:

            divisors.append(i)

            if i != n // i:

                divisors.append(n//i)



    # divisors.sort()

    return divisors

  

def is_prime(q):

    q = abs(q)

    if q == 2: return True

    if q < 2 or q&1 == 0: return False

    return pow(2, q-1, q) == 1

import random



def is_prime3(q,k=50):

    q = abs(q)

    #計算するまでもなく判定できるものははじく

    if q == 2: return True

    if q < 2 or q&1 == 0: return False



    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める

    d = (q-1)>>1

    while d&1 == 0:

        d >>= 1

    

    #判定をk回繰り返す

    for i in range(k):

        a = random.randint(1,q-1)

        t = d

        y = pow(a,t,q)

        #[0,s-1]の範囲すべてをチェック

        while t != q-1 and y != 1 and y != q-1: 

            y = pow(y,2,q)

            t <<= 1

        if y != q-1 and t&1 == 0:

            return False

    return True

  

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

ans = set(make_divisors(A)) &  set(make_divisors(B))

print((sum([is_prime3(i) for i in ans])+1))



from fractions import gcd



def prime_decomposition(n): #素因数分解

  i = 2

  table = []

  while i*i <= n:

    while n%i == 0:

      n /= i

      table.append(i)

    i += 1

  if n > 1:

    table.append(int(n))

  # 重複なし

  return set(table)



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

n_gcd = gcd(A, B)

n_div = prime_decomposition(n_gcd)

print((len(n_div)+1))
import fractions, math


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    # divisors.sort()
    return divisors


def is_prime(q):
    q = abs(q)
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False
    return pow(2, q - 1, q) == 1


import random


def is_prime3(q, k=50):
    q = abs(q)
    # 計算するまでもなく判定できるものははじく
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False
    # n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q - 1) >> 1
    while d & 1 == 0:
        d >>= 1
    # 判定をk回繰り返す
    for i in range(k):
        a = random.randint(1, q - 1)
        t = d
        y = pow(a, t, q)
        # [0,s-1]の範囲すべてをチェック
        while t != q - 1 and y != 1 and y != q - 1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q - 1 and t & 1 == 0:
            return False
    return True


A, B = list(map(int, input().split()))
ans = set(make_divisors(A)) & set(make_divisors(B))
print((sum([is_prime3(i) for i in ans]) + 1))

from fractions import gcd


def prime_decomposition(n):  # 素因数分解
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(int(n))
    # 重複なし
    return set(table)


A, B = list(map(int, input().split()))
n_gcd = gcd(A, B)
n_div = prime_decomposition(n_gcd)
print((len(n_div) + 1))

-import fractions, math +from fractions import gcd -def make_divisors(n): -    divisors = [] -    for i in range(1, int(n**0.5) + 1): -        if n % i == 0: -            divisors.append(i) -            if i != n // i: -                divisors.append(n // i) -    # divisors.sort() -    return divisors - - -def is_prime(q): -    q = abs(q) -    if q == 2: -        return True -    if q < 2 or q & 1 == 0: -        return False -    return pow(2, q - 1, q) == 1 - - -import random - - -def is_prime3(q, k=50): -    q = abs(q) -    # 計算するまでもなく判定できるものははじく -    if q == 2: -        return True -    if q < 2 or q & 1 == 0: -        return False -    # n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める -    d = (q - 1) >> 1 -    while d & 1 == 0: -        d >>= 1 -    # 判定をk回繰り返す -    for i in range(k): -        a = random.randint(1, q - 1) -        t = d -        y = pow(a, t, q) -        # [0,s-1]の範囲すべてをチェック -        while t != q - 1 and y != 1 and y != q - 1: -            y = pow(y, 2, q) -            t <<= 1 -        if y != q - 1 and t & 1 == 0: -            return False -    return True +def prime_decomposition(n):  # 素因数分解 +    i = 2 +    table = [] +    while i * i <= n: +        while n % i == 0: +            n /= i +            table.append(i) +        i += 1 +    if n > 1: +        table.append(int(n)) +    # 重複なし +    return set(table) -ans = set(make_divisors(A)) & set(make_divisors(B)) -print((sum([is_prime3(i) for i in ans]) + 1)) +n_gcd = gcd(A, B) +n_div = prime_decomposition(n_gcd) +print((len(n_div) + 1))