a, b = map(int, input().split())
import fractions
g = fractions.gcd(a, b)

if g == 1:
    print(1)
    exit()

import math
def factorize(n):
    d = {}
    temp = int(math.sqrt(n))+1
    for i in range(2, temp):
        while n%i== 0:
            n //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[n] = 1
    else:
        if n in d:
            d[n] += 1
        elif n != 1:
            d[n] =1
    return d

d = factorize(g)
print(len(d)+1) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b import fractions fractions g = fractions.gcd(a, b) g fractions.gcd(a, b) fractions.gcd fractions gcd a b if g == 1:
    print(1)
    exit() g == 1 g 1 print(1) print 1 exit() exit import math math def factorize(n):
    d = {}
    temp = int(math.sqrt(n))+1
    for i in range(2, temp):
        while n%i== 0:
            n //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[n] = 1
    else:
        if n in d:
            d[n] += 1
        elif n != 1:
            d[n] =1
    return d factorize d = {} d {} temp = int(math.sqrt(n))+1 temp int(math.sqrt(n))+1 int(math.sqrt(n)) int math.sqrt(n) math.sqrt math sqrt n 1 for i in range(2, temp):
        while n%i== 0:
            n //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
     i range(2, temp) range 2 temp while n%i== 0:
            n //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
     n%i== 0 n%i n i 0 n //= i n i if i in d:
                d[i] += 1
            else:
                d[i] = 1
     i in d i d d[i] += 1 d[i] d i 1 d[i] = 1 d[i] d i 1 if d == {}:
        d[n] = 1
    else:
        if n in d:
            d[n] += 1
        elif n != 1:
            d[n] =1
     d == {} d {} d[n] = 1 d[n] d n 1 if n in d:
            d[n] += 1
        elif n != 1:
            d[n] =1
     n in d n d d[n] += 1 d[n] d n 1 elif n != 1:
            d[n] =1
     n != 1 n 1 d[n] =1 d[n] d n 1 return d d n n d = factorize(g) d factorize(g) factorize g print(len(d)+1) print len(d)+1 len(d) len d 1 d = factorize(g) factorize(g) d b = map(int, input().split()) map(int, input().split()) b g = fractions.gcd(a, b) fractions.gcd(a, b) g def factorize(n):
    d = {}
    temp = int(math.sqrt(n))+1
    for i in range(2, temp):
        while n%i== 0:
            n //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[n] = 1
    else:
        if n in d:
            d[n] += 1
        elif n != 1:
            d[n] =1
    return d def factorize(n):
    d = {}
    temp = int(math.sqrt(n))+1
    for i in range(2, temp):
        while n%i== 0:
            n //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[n] = 1
    else:
        if n in d:
            d[n] += 1
        elif n != 1:
            d[n] =1
    return d factorize a, b = map(int, input().split()) map(int, input().split()) a
a, b = map(int, input().split())
import fractions
g = fractions.gcd(a, b)

if g == 1:
    print(1)
    exit()

import math
def factorize(n):
    d = {}
    temp = int(math.sqrt(n))+1
    for i in range(2, temp):
        while n%i== 0:
            n //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[n] = 1
    else:
        if n in d:
            d[n] += 1
        elif n != 1:
            d[n] =1
    return d

d = factorize(g)
print(len(d)+1)
