def main():
    import math
    a,b = map(int,input().split())
    g = math.gcd(a,b)
    ans = [1]
    for m in range(2,int(g**0.5)+1):
        if g%m==0:
            ans.append(m)
            while g%m==0:
                g = g//m
        if g==1:
            break
    if g!=1:
        ans.append(g)
    print(len(ans))

if __name__ == "__main__":
    main() def main():
    import math
    a,b = map(int,input().split())
    g = math.gcd(a,b)
    ans = [1]
    for m in range(2,int(g**0.5)+1):
        if g%m==0:
            ans.append(m)
            while g%m==0:
                g = g//m
        if g==1:
            break
    if g!=1:
        ans.append(g)
    print(len(ans)) main import math math a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b g = math.gcd(a,b) g math.gcd(a,b) math.gcd math gcd a b ans = [1] ans [1] 1 for m in range(2,int(g**0.5)+1):
        if g%m==0:
            ans.append(m)
            while g%m==0:
                g = g//m
        if g==1:
            break
     m range(2,int(g**0.5)+1) range 2 int(g**0.5)+1 int(g**0.5) int g**0.5 g 0.5 1 if g%m==0:
            ans.append(m)
            while g%m==0:
                g = g//m
         g%m==0 g%m g m 0 ans.append(m) ans.append ans append m while g%m==0:
                g = g//m
         g%m==0 g%m g m 0 g = g//m g g//m g m if g==1:
            break
     g==1 g 1 break if g!=1:
        ans.append(g)
     g!=1 g 1 ans.append(g) ans.append ans append g print(len(ans)) print len(ans) len ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    import math
    a,b = map(int,input().split())
    g = math.gcd(a,b)
    ans = [1]
    for m in range(2,int(g**0.5)+1):
        if g%m==0:
            ans.append(m)
            while g%m==0:
                g = g//m
        if g==1:
            break
    if g!=1:
        ans.append(g)
    print(len(ans)) def main():
    import math
    a,b = map(int,input().split())
    g = math.gcd(a,b)
    ans = [1]
    for m in range(2,int(g**0.5)+1):
        if g%m==0:
            ans.append(m)
            while g%m==0:
                g = g//m
        if g==1:
            break
    if g!=1:
        ans.append(g)
    print(len(ans)) main
def main():
    import math
    a,b = map(int,input().split())
    g = math.gcd(a,b)
    ans = [1]
    for m in range(2,int(g**0.5)+1):
        if g%m==0:
            ans.append(m)
            while g%m==0:
                g = g//m
        if g==1:
            break
    if g!=1:
        ans.append(g)
    print(len(ans))

if __name__ == "__main__":
    main()
