
from math import gcd
def resolve():
    def prime_factorize(n):
        if 2 <= n < 4:
            return [n]
        res = []
        i = 2
        while i * i <= n:
            while n % i == 0:
                res.append(i)
                n //= i
            i += 1
        if n != 1:
            res.append(n)

        return set(res)

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

    g = gcd(a, b)
    ans = prime_factorize(g)
    print(len(ans) + 1)


if __name__ == "__main__":
    resolve() from math import gcd def resolve():
    def prime_factorize(n):
        if 2 <= n < 4:
            return [n]
        res = []
        i = 2
        while i * i <= n:
            while n % i == 0:
                res.append(i)
                n //= i
            i += 1
        if n != 1:
            res.append(n)

        return set(res)

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

    g = gcd(a, b)
    ans = prime_factorize(g)
    print(len(ans) + 1) resolve def prime_factorize(n):
        if 2 <= n < 4:
            return [n]
        res = []
        i = 2
        while i * i <= n:
            while n % i == 0:
                res.append(i)
                n //= i
            i += 1
        if n != 1:
            res.append(n)

        return set(res)

     prime_factorize if 2 <= n < 4:
            return [n]
         2 <= n < 4 2 <= n 2 n 4 return [n] [n] n res = [] res [] i = 2 i 2 while i * i <= n:
            while n % i == 0:
                res.append(i)
                n //= i
            i += 1
         i * i <= n i * i i i n while n % i == 0:
                res.append(i)
                n //= i
             n % i == 0 n % i n i 0 res.append(i) res.append res append i n //= i n i i += 1 i 1 if n != 1:
            res.append(n)

         n != 1 n 1 res.append(n) res.append res append n return set(res) set(res) set res n n a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b g = gcd(a, b) g gcd(a, b) gcd a b ans = prime_factorize(g) ans prime_factorize(g) prime_factorize g print(len(ans) + 1) print len(ans) + 1 len(ans) len ans 1 if __name__ == "__main__":
    resolve() __name__ == "__main__" __name__ "__main__" resolve() resolve def resolve():
    def prime_factorize(n):
        if 2 <= n < 4:
            return [n]
        res = []
        i = 2
        while i * i <= n:
            while n % i == 0:
                res.append(i)
                n //= i
            i += 1
        if n != 1:
            res.append(n)

        return set(res)

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

    g = gcd(a, b)
    ans = prime_factorize(g)
    print(len(ans) + 1) def resolve():
    def prime_factorize(n):
        if 2 <= n < 4:
            return [n]
        res = []
        i = 2
        while i * i <= n:
            while n % i == 0:
                res.append(i)
                n //= i
            i += 1
        if n != 1:
            res.append(n)

        return set(res)

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

    g = gcd(a, b)
    ans = prime_factorize(g)
    print(len(ans) + 1) resolve

from math import gcd
def resolve():
    def prime_factorize(n):
        if 2 <= n < 4:
            return [n]
        res = []
        i = 2
        while i * i <= n:
            while n % i == 0:
                res.append(i)
                n //= i
            i += 1
        if n != 1:
            res.append(n)

        return set(res)

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

    g = gcd(a, b)
    ans = prime_factorize(g)
    print(len(ans) + 1)


if __name__ == "__main__":
    resolve()
