import fractions
import math

def primefac(n):
    ret = []
    e = 0
    for i in range(2, math.floor(n**(1/2)) + 1):
        if n % i == 0:
            e = 0
            while n % i == 0:
                e += 1
                n //= i
            ret.append((i, e))
    if n != 1:
        ret.append((n, 1))
    return ret

A, B = map(int, input().split())
c = fractions.gcd(A, B)
print(len(primefac(c))+1) import fractions fractions import math math def primefac(n):
    ret = []
    e = 0
    for i in range(2, math.floor(n**(1/2)) + 1):
        if n % i == 0:
            e = 0
            while n % i == 0:
                e += 1
                n //= i
            ret.append((i, e))
    if n != 1:
        ret.append((n, 1))
    return ret primefac ret = [] ret [] e = 0 e 0 for i in range(2, math.floor(n**(1/2)) + 1):
        if n % i == 0:
            e = 0
            while n % i == 0:
                e += 1
                n //= i
            ret.append((i, e))
     i range(2, math.floor(n**(1/2)) + 1) range 2 math.floor(n**(1/2)) + 1 math.floor(n**(1/2)) math.floor math floor n**(1/2) n 1/2 1 2 1 if n % i == 0:
            e = 0
            while n % i == 0:
                e += 1
                n //= i
            ret.append((i, e))
     n % i == 0 n % i n i 0 e = 0 e 0 while n % i == 0:
                e += 1
                n //= i
             n % i == 0 n % i n i 0 e += 1 e 1 n //= i n i ret.append((i, e)) ret.append ret append (i, e) i e if n != 1:
        ret.append((n, 1))
     n != 1 n 1 ret.append((n, 1)) ret.append ret append (n, 1) n 1 return ret ret n n A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B c = fractions.gcd(A, B) c fractions.gcd(A, B) fractions.gcd fractions gcd A B print(len(primefac(c))+1) print len(primefac(c))+1 len(primefac(c)) len primefac(c) primefac c 1 B = map(int, input().split()) map(int, input().split()) B c = fractions.gcd(A, B) fractions.gcd(A, B) c def primefac(n):
    ret = []
    e = 0
    for i in range(2, math.floor(n**(1/2)) + 1):
        if n % i == 0:
            e = 0
            while n % i == 0:
                e += 1
                n //= i
            ret.append((i, e))
    if n != 1:
        ret.append((n, 1))
    return ret def primefac(n):
    ret = []
    e = 0
    for i in range(2, math.floor(n**(1/2)) + 1):
        if n % i == 0:
            e = 0
            while n % i == 0:
                e += 1
                n //= i
            ret.append((i, e))
    if n != 1:
        ret.append((n, 1))
    return ret primefac A, B = map(int, input().split()) map(int, input().split()) A
import fractions
import math

def primefac(n):
    ret = []
    e = 0
    for i in range(2, math.floor(n**(1/2)) + 1):
        if n % i == 0:
            e = 0
            while n % i == 0:
                e += 1
                n //= i
            ret.append((i, e))
    if n != 1:
        ret.append((n, 1))
    return ret

A, B = map(int, input().split())
c = fractions.gcd(A, B)
print(len(primefac(c))+1)