from math import gcd

def factorization(n):
    pf_cnt = {}
    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
            if i != 1: pf_cnt[i] = cnt

    if temp != 1: pf_cnt[temp] = 1
    if not pf_cnt and n != 1: pf_cnt[n] = 1

    return pf_cnt

a,b = map(int, input().split())
ab_gcd = gcd(a,b)
fac = factorization(ab_gcd)
print(len(fac)+1) from math import gcd def factorization(n):
    pf_cnt = {}
    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
            if i != 1: pf_cnt[i] = cnt

    if temp != 1: pf_cnt[temp] = 1
    if not pf_cnt and n != 1: pf_cnt[n] = 1

    return pf_cnt factorization pf_cnt = {} pf_cnt {} 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
            if i != 1: pf_cnt[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
            if i != 1: pf_cnt[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 if i != 1: pf_cnt[i] = cnt

     i != 1 i 1 if temp != 1: pf_cnt[temp] = 1
     temp != 1 temp 1 if not pf_cnt and n != 1: pf_cnt[n] = 1

     not pf_cnt and n != 1 not pf_cnt pf_cnt n != 1 n 1 return pf_cnt pf_cnt n n a,b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b ab_gcd = gcd(a,b) ab_gcd gcd(a,b) gcd a b fac = factorization(ab_gcd) fac factorization(ab_gcd) factorization ab_gcd print(len(fac)+1) print len(fac)+1 len(fac) len fac 1 a,b = map(int, input().split()) map(int, input().split()) a b = map(int, input().split()) map(int, input().split()) b fac = factorization(ab_gcd) factorization(ab_gcd) fac def factorization(n):
    pf_cnt = {}
    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
            if i != 1: pf_cnt[i] = cnt

    if temp != 1: pf_cnt[temp] = 1
    if not pf_cnt and n != 1: pf_cnt[n] = 1

    return pf_cnt def factorization(n):
    pf_cnt = {}
    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
            if i != 1: pf_cnt[i] = cnt

    if temp != 1: pf_cnt[temp] = 1
    if not pf_cnt and n != 1: pf_cnt[n] = 1

    return pf_cnt factorization ab_gcd = gcd(a,b) gcd(a,b) ab_gcd
from math import gcd

def factorization(n):
    pf_cnt = {}
    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
            if i != 1: pf_cnt[i] = cnt

    if temp != 1: pf_cnt[temp] = 1
    if not pf_cnt and n != 1: pf_cnt[n] = 1

    return pf_cnt

a,b = map(int, input().split())
ab_gcd = gcd(a,b)
fac = factorization(ab_gcd)
print(len(fac)+1)