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

    def enum_divisors(n):
        # 約数列挙
        divs = set()
        for i in range(1, n+1):
            if i*i > n:
                break
            if n % i == 0:
                divs.add(i)
                if n//i != i:
                    # i が平方数でない
                    divs.add(n//i)
        return divs

    divs = enum_divisors(N) & enum_divisors(M)
    ans = 1
    v = 1
    from math import gcd
    for s in sorted(divs):
        if s == 1:
            continue
        if gcd(v, s) == 1:
            v *= s
            ans += 1
    print(ans)


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

    def enum_divisors(n):
        # 約数列挙
        divs = set()
        for i in range(1, n+1):
            if i*i > n:
                break
            if n % i == 0:
                divs.add(i)
                if n//i != i:
                    # i が平方数でない
                    divs.add(n//i)
        return divs

    divs = enum_divisors(N) & enum_divisors(M)
    ans = 1
    v = 1
    from math import gcd
    for s in sorted(divs):
        if s == 1:
            continue
        if gcd(v, s) == 1:
            v *= s
            ans += 1
    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 enum_divisors(n):
        # 約数列挙
        divs = set()
        for i in range(1, n+1):
            if i*i > n:
                break
            if n % i == 0:
                divs.add(i)
                if n//i != i:
                    # i が平方数でない
                    divs.add(n//i)
        return divs

     enum_divisors divs = set() divs set() set for i in range(1, n+1):
            if i*i > n:
                break
            if n % i == 0:
                divs.add(i)
                if n//i != i:
                    # i が平方数でない
                    divs.add(n//i)
         i range(1, n+1) range 1 n+1 n 1 if i*i > n:
                break
             i*i > n i*i i i n break if n % i == 0:
                divs.add(i)
                if n//i != i:
                    # i が平方数でない
                    divs.add(n//i)
         n % i == 0 n % i n i 0 divs.add(i) divs.add divs add i if n//i != i:
                    # i が平方数でない
                    divs.add(n//i)
         n//i != i n//i n i i divs.add(n//i) divs.add divs add n//i n i return divs divs n n divs = enum_divisors(N) & enum_divisors(M) divs enum_divisors(N) & enum_divisors(M) enum_divisors(N) enum_divisors N enum_divisors(M) enum_divisors M ans = 1 ans 1 v = 1 v 1 from math import gcd for s in sorted(divs):
        if s == 1:
            continue
        if gcd(v, s) == 1:
            v *= s
            ans += 1
     s sorted(divs) sorted divs if s == 1:
            continue
         s == 1 s 1 continue if gcd(v, s) == 1:
            v *= s
            ans += 1
     gcd(v, s) == 1 gcd(v, s) gcd v s 1 v *= s v s ans += 1 ans 1 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 enum_divisors(n):
        # 約数列挙
        divs = set()
        for i in range(1, n+1):
            if i*i > n:
                break
            if n % i == 0:
                divs.add(i)
                if n//i != i:
                    # i が平方数でない
                    divs.add(n//i)
        return divs

    divs = enum_divisors(N) & enum_divisors(M)
    ans = 1
    v = 1
    from math import gcd
    for s in sorted(divs):
        if s == 1:
            continue
        if gcd(v, s) == 1:
            v *= s
            ans += 1
    print(ans) def main():
    N, M = (int(i) for i in input().split())

    def enum_divisors(n):
        # 約数列挙
        divs = set()
        for i in range(1, n+1):
            if i*i > n:
                break
            if n % i == 0:
                divs.add(i)
                if n//i != i:
                    # i が平方数でない
                    divs.add(n//i)
        return divs

    divs = enum_divisors(N) & enum_divisors(M)
    ans = 1
    v = 1
    from math import gcd
    for s in sorted(divs):
        if s == 1:
            continue
        if gcd(v, s) == 1:
            v *= s
            ans += 1
    print(ans) main
def main():
    N, M = (int(i) for i in input().split())

    def enum_divisors(n):
        # 約数列挙
        divs = set()
        for i in range(1, n+1):
            if i*i > n:
                break
            if n % i == 0:
                divs.add(i)
                if n//i != i:
                    # i が平方数でない
                    divs.add(n//i)
        return divs

    divs = enum_divisors(N) & enum_divisors(M)
    ans = 1
    v = 1
    from math import gcd
    for s in sorted(divs):
        if s == 1:
            continue
        if gcd(v, s) == 1:
            v *= s
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
