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

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

def cal(c):
    d = []
    while c%2 == 0:
        d.append(2)
        c //= 2
    f = 3
    while f**2 <= c:
        if c%f == 0:
            d.append(f)
            c //= f
        else:
            f += 2
    if c != 1:
        d.append(c)
    return d
    
c = gcd(a, b)
d = cal(c)
print(len(set(d))+1) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b) gcd if b == 0:
        return a
    else:
        return gcd(b, a%b) 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 def cal(c):
    d = []
    while c%2 == 0:
        d.append(2)
        c //= 2
    f = 3
    while f**2 <= c:
        if c%f == 0:
            d.append(f)
            c //= f
        else:
            f += 2
    if c != 1:
        d.append(c)
    return d
     cal d = [] d [] while c%2 == 0:
        d.append(2)
        c //= 2
     c%2 == 0 c%2 c 2 0 d.append(2) d.append d append 2 c //= 2 c 2 f = 3 f 3 while f**2 <= c:
        if c%f == 0:
            d.append(f)
            c //= f
        else:
            f += 2
     f**2 <= c f**2 f 2 c if c%f == 0:
            d.append(f)
            c //= f
        else:
            f += 2
     c%f == 0 c%f c f 0 d.append(f) d.append d append f c //= f c f f += 2 f 2 if c != 1:
        d.append(c)
     c != 1 c 1 d.append(c) d.append d append c return d d c c c = gcd(a, b) c gcd(a, b) gcd a b d = cal(c) d cal(c) cal c print(len(set(d))+1) print len(set(d))+1 len(set(d)) len set(d) set d 1 a, b = map(int, input().split()) map(int, input().split()) a b = map(int, input().split()) map(int, input().split()) b c = gcd(a, b) gcd(a, b) c def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b) def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b) gcd d = cal(c) cal(c) d def cal(c):
    d = []
    while c%2 == 0:
        d.append(2)
        c //= 2
    f = 3
    while f**2 <= c:
        if c%f == 0:
            d.append(f)
            c //= f
        else:
            f += 2
    if c != 1:
        d.append(c)
    return d
     def cal(c):
    d = []
    while c%2 == 0:
        d.append(2)
        c //= 2
    f = 3
    while f**2 <= c:
        if c%f == 0:
            d.append(f)
            c //= f
        else:
            f += 2
    if c != 1:
        d.append(c)
    return d
     cal
a, b = map(int, input().split())

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

def cal(c):
    d = []
    while c%2 == 0:
        d.append(2)
        c //= 2
    f = 3
    while f**2 <= c:
        if c%f == 0:
            d.append(f)
            c //= f
        else:
            f += 2
    if c != 1:
        d.append(c)
    return d
    
c = gcd(a, b)
d = cal(c)
print(len(set(d))+1)
