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

    def prime_factorize(n):
        res = set()
        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.add(i)
        if n != 1:
            res.add(n)
        return res

    pf_N = prime_factorize(N)
    pf_M = prime_factorize(M)

    ans = 1 + len(pf_N & pf_M)

    print(ans)


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

    def prime_factorize(n):
        res = set()
        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.add(i)
        if n != 1:
            res.add(n)
        return res

    pf_N = prime_factorize(N)
    pf_M = prime_factorize(M)

    ans = 1 + len(pf_N & pf_M)

    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 = set()
        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.add(i)
        if n != 1:
            res.add(n)
        return res

     prime_factorize res = set() res set() set 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.add(i)
         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.add(i) res.add res add i if n != 1:
            res.add(n)
         n != 1 n 1 res.add(n) res.add res add n return res res n n pf_N = prime_factorize(N) pf_N prime_factorize(N) prime_factorize N pf_M = prime_factorize(M) pf_M prime_factorize(M) prime_factorize M ans = 1 + len(pf_N & pf_M) ans 1 + len(pf_N & pf_M) 1 len(pf_N & pf_M) len pf_N & pf_M pf_N pf_M 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 = set()
        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.add(i)
        if n != 1:
            res.add(n)
        return res

    pf_N = prime_factorize(N)
    pf_M = prime_factorize(M)

    ans = 1 + len(pf_N & pf_M)

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

    def prime_factorize(n):
        res = set()
        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.add(i)
        if n != 1:
            res.add(n)
        return res

    pf_N = prime_factorize(N)
    pf_M = prime_factorize(M)

    ans = 1 + len(pf_N & pf_M)

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

    def prime_factorize(n):
        res = set()
        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.add(i)
        if n != 1:
            res.add(n)
        return res

    pf_N = prime_factorize(N)
    pf_M = prime_factorize(M)

    ans = 1 + len(pf_N & pf_M)

    print(ans)


if __name__ == '__main__':
    main()
