def main():
    N, M = (int(i) for i in input().split())

    def prime_factorize(n):
        res = []
        for i in range(2, n+1):
            if i*i > n:
                break
            if n % i != 0:
                continue
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

    from math import gcd
    g = gcd(N, M)
    pf = prime_factorize(g)

    ans = 1 + len(pf)

    print(ans)


if __name__ == '__main__':
    main() def main():
    N, M = (int(i) for i in input().split())

    def prime_factorize(n):
        res = []
        for i in range(2, n+1):
            if i*i > n:
                break
            if n % i != 0:
                continue
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

    from math import gcd
    g = gcd(N, M)
    pf = prime_factorize(g)

    ans = 1 + len(pf)

    print(ans) main int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i N, M = (int(i) for i in input().split()) N (int(i) for i in input().split()) M def prime_factorize(n):
        res = []
        for i in range(2, n+1):
            if i*i > n:
                break
            if n % i != 0:
                continue
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

     prime_factorize res = [] res [] for i in range(2, n+1):
            if i*i > n:
                break
            if n % i != 0:
                continue
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.append((i, ex))
         i range(2, n+1) range 2 n+1 n 1 if i*i > n:
                break
             i*i > n i*i i i n break if n % i != 0:
                continue
             n % i != 0 n % i n i 0 continue ex = 0 ex 0 while n % i == 0:
                ex += 1
                n //= i
             n % i == 0 n % i n i 0 ex += 1 ex 1 n //= i n i res.append((i, ex)) res.append res append (i, ex) i ex if n != 1:
            res.append((n, 1))
         n != 1 n 1 res.append((n, 1)) res.append res append (n, 1) n 1 return res res n n from math import gcd g = gcd(N, M) g gcd(N, M) gcd N M pf = prime_factorize(g) pf prime_factorize(g) prime_factorize g ans = 1 + len(pf) ans 1 + len(pf) 1 len(pf) len pf print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N, M = (int(i) for i in input().split())

    def prime_factorize(n):
        res = []
        for i in range(2, n+1):
            if i*i > n:
                break
            if n % i != 0:
                continue
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

    from math import gcd
    g = gcd(N, M)
    pf = prime_factorize(g)

    ans = 1 + len(pf)

    print(ans) def main():
    N, M = (int(i) for i in input().split())

    def prime_factorize(n):
        res = []
        for i in range(2, n+1):
            if i*i > n:
                break
            if n % i != 0:
                continue
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

    from math import gcd
    g = gcd(N, M)
    pf = prime_factorize(g)

    ans = 1 + len(pf)

    print(ans) main
def main():
    N, M = (int(i) for i in input().split())

    def prime_factorize(n):
        res = []
        for i in range(2, n+1):
            if i*i > n:
                break
            if n % i != 0:
                continue
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

    from math import gcd
    g = gcd(N, M)
    pf = prime_factorize(g)

    ans = 1 + len(pf)

    print(ans)


if __name__ == '__main__':
    main()
