def main():
    a, b = list(map(int, input().split()))
    def factorization(num):
        result = set()
        count = 0
        temp = num
        for i in range(2, int(num ** 0.5) + 1):
            if temp % i == 0:
                count = 0
                while temp % i == 0:
                    count += 1
                    temp /= i
                result.add(i)
        if temp != 1:
            result.add(int(temp))
        if result == []:
            result.add(num)
        return result
    print(len(factorization(a) & factorization(b)) + 1)



if __name__ == '__main__':
    main() def main():
    a, b = list(map(int, input().split()))
    def factorization(num):
        result = set()
        count = 0
        temp = num
        for i in range(2, int(num ** 0.5) + 1):
            if temp % i == 0:
                count = 0
                while temp % i == 0:
                    count += 1
                    temp /= i
                result.add(i)
        if temp != 1:
            result.add(int(temp))
        if result == []:
            result.add(num)
        return result
    print(len(factorization(a) & factorization(b)) + 1) main a, b = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split b def factorization(num):
        result = set()
        count = 0
        temp = num
        for i in range(2, int(num ** 0.5) + 1):
            if temp % i == 0:
                count = 0
                while temp % i == 0:
                    count += 1
                    temp /= i
                result.add(i)
        if temp != 1:
            result.add(int(temp))
        if result == []:
            result.add(num)
        return result
     factorization result = set() result set() set count = 0 count 0 temp = num temp num for i in range(2, int(num ** 0.5) + 1):
            if temp % i == 0:
                count = 0
                while temp % i == 0:
                    count += 1
                    temp /= i
                result.add(i)
         i range(2, int(num ** 0.5) + 1) range 2 int(num ** 0.5) + 1 int(num ** 0.5) int num ** 0.5 num 0.5 1 if temp % i == 0:
                count = 0
                while temp % i == 0:
                    count += 1
                    temp /= i
                result.add(i)
         temp % i == 0 temp % i temp i 0 count = 0 count 0 while temp % i == 0:
                    count += 1
                    temp /= i
                 temp % i == 0 temp % i temp i 0 count += 1 count 1 temp /= i temp i result.add(i) result.add result add i if temp != 1:
            result.add(int(temp))
         temp != 1 temp 1 result.add(int(temp)) result.add result add int(temp) int temp if result == []:
            result.add(num)
         result == [] result [] result.add(num) result.add result add num return result result num num print(len(factorization(a) & factorization(b)) + 1) print len(factorization(a) & factorization(b)) + 1 len(factorization(a) & factorization(b)) len factorization(a) & factorization(b) factorization(a) factorization a factorization(b) factorization b 1 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    a, b = list(map(int, input().split()))
    def factorization(num):
        result = set()
        count = 0
        temp = num
        for i in range(2, int(num ** 0.5) + 1):
            if temp % i == 0:
                count = 0
                while temp % i == 0:
                    count += 1
                    temp /= i
                result.add(i)
        if temp != 1:
            result.add(int(temp))
        if result == []:
            result.add(num)
        return result
    print(len(factorization(a) & factorization(b)) + 1) def main():
    a, b = list(map(int, input().split()))
    def factorization(num):
        result = set()
        count = 0
        temp = num
        for i in range(2, int(num ** 0.5) + 1):
            if temp % i == 0:
                count = 0
                while temp % i == 0:
                    count += 1
                    temp /= i
                result.add(i)
        if temp != 1:
            result.add(int(temp))
        if result == []:
            result.add(num)
        return result
    print(len(factorization(a) & factorization(b)) + 1) main
def main():
    a, b = list(map(int, input().split()))
    def factorization(num):
        result = set()
        count = 0
        temp = num
        for i in range(2, int(num ** 0.5) + 1):
            if temp % i == 0:
                count = 0
                while temp % i == 0:
                    count += 1
                    temp /= i
                result.add(i)
        if temp != 1:
            result.add(int(temp))
        if result == []:
            result.add(num)
        return result
    print(len(factorization(a) & factorization(b)) + 1)



if __name__ == '__main__':
    main()
