import sys
import math

A, B = map(int, sys.stdin.readline().split())
gcd = math.gcd(A, B)


def factrization_prime(number):
    factor = {}
    div = 2
    s = math.sqrt(number)
    # print(s)
    while div < s:
        div_cnt = 0
        while number % div == 0:
            div_cnt += 1
            number //= div
        if div_cnt != 0:
            factor[div] = div_cnt
        div += 1
    if number > 1:
        factor[number] = 1
    return factor

factors = factrization_prime(gcd)
print(len(factors) + 1) import sys sys import math math A, B = map(int, sys.stdin.readline().split()) A map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split B gcd = math.gcd(A, B) gcd math.gcd(A, B) math.gcd math gcd A B def factrization_prime(number):
    factor = {}
    div = 2
    s = math.sqrt(number)
    # print(s)
    while div < s:
        div_cnt = 0
        while number % div == 0:
            div_cnt += 1
            number //= div
        if div_cnt != 0:
            factor[div] = div_cnt
        div += 1
    if number > 1:
        factor[number] = 1
    return factor factrization_prime factor = {} factor {} div = 2 div 2 s = math.sqrt(number) s math.sqrt(number) math.sqrt math sqrt number while div < s:
        div_cnt = 0
        while number % div == 0:
            div_cnt += 1
            number //= div
        if div_cnt != 0:
            factor[div] = div_cnt
        div += 1
     div < s div s div_cnt = 0 div_cnt 0 while number % div == 0:
            div_cnt += 1
            number //= div
         number % div == 0 number % div number div 0 div_cnt += 1 div_cnt 1 number //= div number div if div_cnt != 0:
            factor[div] = div_cnt
         div_cnt != 0 div_cnt 0 factor[div] = div_cnt factor[div] factor div div_cnt div += 1 div 1 if number > 1:
        factor[number] = 1
     number > 1 number 1 factor[number] = 1 factor[number] factor number 1 return factor factor number number factors = factrization_prime(gcd) factors factrization_prime(gcd) factrization_prime gcd print(len(factors) + 1) print len(factors) + 1 len(factors) len factors 1 factors = factrization_prime(gcd) factrization_prime(gcd) factors def factrization_prime(number):
    factor = {}
    div = 2
    s = math.sqrt(number)
    # print(s)
    while div < s:
        div_cnt = 0
        while number % div == 0:
            div_cnt += 1
            number //= div
        if div_cnt != 0:
            factor[div] = div_cnt
        div += 1
    if number > 1:
        factor[number] = 1
    return factor def factrization_prime(number):
    factor = {}
    div = 2
    s = math.sqrt(number)
    # print(s)
    while div < s:
        div_cnt = 0
        while number % div == 0:
            div_cnt += 1
            number //= div
        if div_cnt != 0:
            factor[div] = div_cnt
        div += 1
    if number > 1:
        factor[number] = 1
    return factor factrization_prime gcd = math.gcd(A, B) math.gcd(A, B) gcd B = map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) B A, B = map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) A
import sys
import math

A, B = map(int, sys.stdin.readline().split())
gcd = math.gcd(A, B)


def factrization_prime(number):
    factor = {}
    div = 2
    s = math.sqrt(number)
    # print(s)
    while div < s:
        div_cnt = 0
        while number % div == 0:
            div_cnt += 1
            number //= div
        if div_cnt != 0:
            factor[div] = div_cnt
        div += 1
    if number > 1:
        factor[number] = 1
    return factor

factors = factrization_prime(gcd)
print(len(factors) + 1)