from math import gcd
def main():
    def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr.append([i, cnt])
        if temp != 1:
            arr.append([temp, 1])
        if arr == []:
            arr.append([n, 1])
        return arr

    a, b = map(int, input().split())
    g = gcd(a,b)
    g_fac = factorization(g)
    r = len(g_fac)
    if g_fac[0][0] != 1:
        r += 1
    print(r)

if __name__ == '__main__':
    main() from math import gcd def main():
    def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr.append([i, cnt])
        if temp != 1:
            arr.append([temp, 1])
        if arr == []:
            arr.append([n, 1])
        return arr

    a, b = map(int, input().split())
    g = gcd(a,b)
    g_fac = factorization(g)
    r = len(g_fac)
    if g_fac[0][0] != 1:
        r += 1
    print(r) main def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr.append([i, cnt])
        if temp != 1:
            arr.append([temp, 1])
        if arr == []:
            arr.append([n, 1])
        return arr

     factorization arr = [] arr [] temp = n temp n for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr.append([i, cnt])
         i range(2, int(-(-n ** 0.5 // 1)) + 1) range 2 int(-(-n ** 0.5 // 1)) + 1 int(-(-n ** 0.5 // 1)) int -(-n ** 0.5 // 1) -n ** 0.5 // 1 -n ** 0.5 n ** 0.5 n 0.5 1 1 if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr.append([i, cnt])
         temp % i == 0 temp % i temp i 0 cnt = 0 cnt 0 while temp % i == 0:
                    cnt += 1
                    temp //= i
                 temp % i == 0 temp % i temp i 0 cnt += 1 cnt 1 temp //= i temp i arr.append([i, cnt]) arr.append arr append [i, cnt] i cnt if temp != 1:
            arr.append([temp, 1])
         temp != 1 temp 1 arr.append([temp, 1]) arr.append arr append [temp, 1] temp 1 if arr == []:
            arr.append([n, 1])
         arr == [] arr [] arr.append([n, 1]) arr.append arr append [n, 1] n 1 return arr arr n n a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b g = gcd(a,b) g gcd(a,b) gcd a b g_fac = factorization(g) g_fac factorization(g) factorization g r = len(g_fac) r len(g_fac) len g_fac if g_fac[0][0] != 1:
        r += 1
     g_fac[0][0] != 1 g_fac[0][0] [0] g_fac 0 0 1 r += 1 r 1 print(r) print r if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr.append([i, cnt])
        if temp != 1:
            arr.append([temp, 1])
        if arr == []:
            arr.append([n, 1])
        return arr

    a, b = map(int, input().split())
    g = gcd(a,b)
    g_fac = factorization(g)
    r = len(g_fac)
    if g_fac[0][0] != 1:
        r += 1
    print(r) def main():
    def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr.append([i, cnt])
        if temp != 1:
            arr.append([temp, 1])
        if arr == []:
            arr.append([n, 1])
        return arr

    a, b = map(int, input().split())
    g = gcd(a,b)
    g_fac = factorization(g)
    r = len(g_fac)
    if g_fac[0][0] != 1:
        r += 1
    print(r) main
from math import gcd
def main():
    def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr.append([i, cnt])
        if temp != 1:
            arr.append([temp, 1])
        if arr == []:
            arr.append([n, 1])
        return arr

    a, b = map(int, input().split())
    g = gcd(a,b)
    g_fac = factorization(g)
    r = len(g_fac)
    if g_fac[0][0] != 1:
        r += 1
    print(r)

if __name__ == '__main__':
    main()
