def main():

    def factorization(n):
        l = []
        tmp = n
        i = 2
        while i*i <= n:
            if tmp%i == 0:
                while tmp%i == 0:
                    tmp //= i
                l.append(i)
            i += 1
        if tmp != 1:
            l.append(tmp)
        if l == []:
            if n != 1:
                l.append(n)
        return l

    a, b = map(int, input().split())
    a_f = factorization(a)
    b_f = factorization(b)
    ans = len(set(a_f) & set(b_f)) + 1
    print(ans)
    
if __name__ == '__main__':
    main() def main():

    def factorization(n):
        l = []
        tmp = n
        i = 2
        while i*i <= n:
            if tmp%i == 0:
                while tmp%i == 0:
                    tmp //= i
                l.append(i)
            i += 1
        if tmp != 1:
            l.append(tmp)
        if l == []:
            if n != 1:
                l.append(n)
        return l

    a, b = map(int, input().split())
    a_f = factorization(a)
    b_f = factorization(b)
    ans = len(set(a_f) & set(b_f)) + 1
    print(ans)
     main def factorization(n):
        l = []
        tmp = n
        i = 2
        while i*i <= n:
            if tmp%i == 0:
                while tmp%i == 0:
                    tmp //= i
                l.append(i)
            i += 1
        if tmp != 1:
            l.append(tmp)
        if l == []:
            if n != 1:
                l.append(n)
        return l

     factorization l = [] l [] tmp = n tmp n i = 2 i 2 while i*i <= n:
            if tmp%i == 0:
                while tmp%i == 0:
                    tmp //= i
                l.append(i)
            i += 1
         i*i <= n i*i i i n if tmp%i == 0:
                while tmp%i == 0:
                    tmp //= i
                l.append(i)
             tmp%i == 0 tmp%i tmp i 0 while tmp%i == 0:
                    tmp //= i
                 tmp%i == 0 tmp%i tmp i 0 tmp //= i tmp i l.append(i) l.append l append i i += 1 i 1 if tmp != 1:
            l.append(tmp)
         tmp != 1 tmp 1 l.append(tmp) l.append l append tmp if l == []:
            if n != 1:
                l.append(n)
         l == [] l [] if n != 1:
                l.append(n)
         n != 1 n 1 l.append(n) l.append l append n return l l n n a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b a_f = factorization(a) a_f factorization(a) factorization a b_f = factorization(b) b_f factorization(b) factorization b ans = len(set(a_f) & set(b_f)) + 1 ans len(set(a_f) & set(b_f)) + 1 len(set(a_f) & set(b_f)) len set(a_f) & set(b_f) set(a_f) set a_f set(b_f) set b_f 1 print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():

    def factorization(n):
        l = []
        tmp = n
        i = 2
        while i*i <= n:
            if tmp%i == 0:
                while tmp%i == 0:
                    tmp //= i
                l.append(i)
            i += 1
        if tmp != 1:
            l.append(tmp)
        if l == []:
            if n != 1:
                l.append(n)
        return l

    a, b = map(int, input().split())
    a_f = factorization(a)
    b_f = factorization(b)
    ans = len(set(a_f) & set(b_f)) + 1
    print(ans)
     def main():

    def factorization(n):
        l = []
        tmp = n
        i = 2
        while i*i <= n:
            if tmp%i == 0:
                while tmp%i == 0:
                    tmp //= i
                l.append(i)
            i += 1
        if tmp != 1:
            l.append(tmp)
        if l == []:
            if n != 1:
                l.append(n)
        return l

    a, b = map(int, input().split())
    a_f = factorization(a)
    b_f = factorization(b)
    ans = len(set(a_f) & set(b_f)) + 1
    print(ans)
     main
def main():

    def factorization(n):
        l = []
        tmp = n
        i = 2
        while i*i <= n:
            if tmp%i == 0:
                while tmp%i == 0:
                    tmp //= i
                l.append(i)
            i += 1
        if tmp != 1:
            l.append(tmp)
        if l == []:
            if n != 1:
                l.append(n)
        return l

    a, b = map(int, input().split())
    a_f = factorization(a)
    b_f = factorization(b)
    ans = len(set(a_f) & set(b_f)) + 1
    print(ans)
    
if __name__ == '__main__':
    main()