a, b = list(map(int, input().split()))

def gcd(a, b):
    if a == 0:
        return b
    elif b == 0:
        return a
    else:
        return gcd(b, a%b)

p = gcd(a, b)
factors = {}

while p > 1:
    f = False
    for i in range(2, int(p**0.5)+1):
        if p % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1

            p //= i
            f = True
            break

    if not f:
        if p in factors:
            factors[p] += 1
        else:
            factors[p] = 1
        break

print(len(factors)+1) a, b = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split b def gcd(a, b):
    if a == 0:
        return b
    elif b == 0:
        return a
    else:
        return gcd(b, a%b) gcd if a == 0:
        return b
    elif b == 0:
        return a
    else:
        return gcd(b, a%b) a == 0 a 0 return b b elif b == 0:
        return a
     b == 0 b 0 return a a return gcd(b, a%b) gcd(b, a%b) gcd b a%b a b a a b b p = gcd(a, b) p gcd(a, b) gcd a b factors = {} factors {} while p > 1:
    f = False
    for i in range(2, int(p**0.5)+1):
        if p % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1

            p //= i
            f = True
            break

    if not f:
        if p in factors:
            factors[p] += 1
        else:
            factors[p] = 1
        break p > 1 p 1 f = False f False for i in range(2, int(p**0.5)+1):
        if p % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1

            p //= i
            f = True
            break

     i range(2, int(p**0.5)+1) range 2 int(p**0.5)+1 int(p**0.5) int p**0.5 p 0.5 1 if p % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1

            p //= i
            f = True
            break

     p % i == 0 p % i p i 0 if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1

             i in factors i factors factors[i] += 1 factors[i] factors i 1 factors[i] = 1 factors[i] factors i 1 p //= i p i f = True f True break if not f:
        if p in factors:
            factors[p] += 1
        else:
            factors[p] = 1
        break not f f if p in factors:
            factors[p] += 1
        else:
            factors[p] = 1
         p in factors p factors factors[p] += 1 factors[p] factors p 1 factors[p] = 1 factors[p] factors p 1 break print(len(factors)+1) print len(factors)+1 len(factors) len factors 1 f = True True f a, b = list(map(int, input().split())) list(map(int, input().split())) a p = gcd(a, b) gcd(a, b) p f = False False f p //= i i p b = list(map(int, input().split())) list(map(int, input().split())) b def gcd(a, b):
    if a == 0:
        return b
    elif b == 0:
        return a
    else:
        return gcd(b, a%b) def gcd(a, b):
    if a == 0:
        return b
    elif b == 0:
        return a
    else:
        return gcd(b, a%b) gcd factors = {} {} factors
a, b = list(map(int, input().split()))

def gcd(a, b):
    if a == 0:
        return b
    elif b == 0:
        return a
    else:
        return gcd(b, a%b)

p = gcd(a, b)
factors = {}

while p > 1:
    f = False
    for i in range(2, int(p**0.5)+1):
        if p % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1

            p //= i
            f = True
            break

    if not f:
        if p in factors:
            factors[p] += 1
        else:
            factors[p] = 1
        break

print(len(factors)+1)