import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
import fractions
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    a,b = map(int,ipt().split())
    g = fractions.gcd(a,b)

    #素因数分解
    def factorization(n):
        d = dict()
        ni = n
        pn = 2
        t = 0
        while pn**2 <= n and ni > 1:
            if ni%pn == 0:
                t += 1
                ni //= pn
            else:
                if not t == 0:
                    d[pn] = t
                    t = 0
                if pn == 2:
                    pn = 3
                else:
                    pn += 2
        if t > 0:
            d[pn] = t
        if ni > 1:
            d[ni] = 1
        return d

    d = factorization(g)
    print(len(d.keys())+1)
    return

if __name__ == '__main__':
    main() import math math import queue queue from collections import deque,defaultdict import heapq as hpq heapq from sys import stdin,setrecursionlimit import fractions fractions ipt = stdin.readline ipt stdin.readline stdin readline setrecursionlimit(10**7) setrecursionlimit 10**7 10 7 def main():
    a,b = map(int,ipt().split())
    g = fractions.gcd(a,b)

    #素因数分解
    def factorization(n):
        d = dict()
        ni = n
        pn = 2
        t = 0
        while pn**2 <= n and ni > 1:
            if ni%pn == 0:
                t += 1
                ni //= pn
            else:
                if not t == 0:
                    d[pn] = t
                    t = 0
                if pn == 2:
                    pn = 3
                else:
                    pn += 2
        if t > 0:
            d[pn] = t
        if ni > 1:
            d[ni] = 1
        return d

    d = factorization(g)
    print(len(d.keys())+1)
    return main a,b = map(int,ipt().split()) a map(int,ipt().split()) map int ipt().split() ().split () ipt split b g = fractions.gcd(a,b) g fractions.gcd(a,b) fractions.gcd fractions gcd a b def factorization(n):
        d = dict()
        ni = n
        pn = 2
        t = 0
        while pn**2 <= n and ni > 1:
            if ni%pn == 0:
                t += 1
                ni //= pn
            else:
                if not t == 0:
                    d[pn] = t
                    t = 0
                if pn == 2:
                    pn = 3
                else:
                    pn += 2
        if t > 0:
            d[pn] = t
        if ni > 1:
            d[ni] = 1
        return d

     factorization d = dict() d dict() dict ni = n ni n pn = 2 pn 2 t = 0 t 0 while pn**2 <= n and ni > 1:
            if ni%pn == 0:
                t += 1
                ni //= pn
            else:
                if not t == 0:
                    d[pn] = t
                    t = 0
                if pn == 2:
                    pn = 3
                else:
                    pn += 2
         pn**2 <= n and ni > 1 pn**2 <= n pn**2 pn 2 n ni > 1 ni 1 if ni%pn == 0:
                t += 1
                ni //= pn
            else:
                if not t == 0:
                    d[pn] = t
                    t = 0
                if pn == 2:
                    pn = 3
                else:
                    pn += 2
         ni%pn == 0 ni%pn ni pn 0 t += 1 t 1 ni //= pn ni pn if not t == 0:
                    d[pn] = t
                    t = 0
                 not t == 0 t == 0 t 0 d[pn] = t d[pn] d pn t t = 0 t 0 if pn == 2:
                    pn = 3
                else:
                    pn += 2
         pn == 2 pn 2 pn = 3 pn 3 pn += 2 pn 2 if t > 0:
            d[pn] = t
         t > 0 t 0 d[pn] = t d[pn] d pn t if ni > 1:
            d[ni] = 1
         ni > 1 ni 1 d[ni] = 1 d[ni] d ni 1 return d d n n d = factorization(g) d factorization(g) factorization g print(len(d.keys())+1) print len(d.keys())+1 len(d.keys()) len d.keys() d.keys d keys 1 return if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    a,b = map(int,ipt().split())
    g = fractions.gcd(a,b)

    #素因数分解
    def factorization(n):
        d = dict()
        ni = n
        pn = 2
        t = 0
        while pn**2 <= n and ni > 1:
            if ni%pn == 0:
                t += 1
                ni //= pn
            else:
                if not t == 0:
                    d[pn] = t
                    t = 0
                if pn == 2:
                    pn = 3
                else:
                    pn += 2
        if t > 0:
            d[pn] = t
        if ni > 1:
            d[ni] = 1
        return d

    d = factorization(g)
    print(len(d.keys())+1)
    return def main():
    a,b = map(int,ipt().split())
    g = fractions.gcd(a,b)

    #素因数分解
    def factorization(n):
        d = dict()
        ni = n
        pn = 2
        t = 0
        while pn**2 <= n and ni > 1:
            if ni%pn == 0:
                t += 1
                ni //= pn
            else:
                if not t == 0:
                    d[pn] = t
                    t = 0
                if pn == 2:
                    pn = 3
                else:
                    pn += 2
        if t > 0:
            d[pn] = t
        if ni > 1:
            d[ni] = 1
        return d

    d = factorization(g)
    print(len(d.keys())+1)
    return main ipt = stdin.readline stdin.readline ipt
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
import fractions
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    a,b = map(int,ipt().split())
    g = fractions.gcd(a,b)

    #素因数分解
    def factorization(n):
        d = dict()
        ni = n
        pn = 2
        t = 0
        while pn**2 <= n and ni > 1:
            if ni%pn == 0:
                t += 1
                ni //= pn
            else:
                if not t == 0:
                    d[pn] = t
                    t = 0
                if pn == 2:
                    pn = 3
                else:
                    pn += 2
        if t > 0:
            d[pn] = t
        if ni > 1:
            d[ni] = 1
        return d

    d = factorization(g)
    print(len(d.keys())+1)
    return

if __name__ == '__main__':
    main()
