from math import *
from copy import deepcopy
A,B = map(int,input().split())
C = gcd(A,B)
E = deepcopy(C)
D = set()
for i in range(2,floor(sqrt(E))+1):
    while True:
        if C/i != (C/i)//1:
            break
        D.add(i)
        C /= i
if C != 1:
    D.add(int(C))
print(len(D)+1) from math import * from copy import deepcopy A,B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B C = gcd(A,B) C gcd(A,B) gcd A B E = deepcopy(C) E deepcopy(C) deepcopy C D = set() D set() set for i in range(2,floor(sqrt(E))+1):
    while True:
        if C/i != (C/i)//1:
            break
        D.add(i)
        C /= i i range(2,floor(sqrt(E))+1) range 2 floor(sqrt(E))+1 floor(sqrt(E)) floor sqrt(E) sqrt E 1 while True:
        if C/i != (C/i)//1:
            break
        D.add(i)
        C /= i True if C/i != (C/i)//1:
            break
         C/i != (C/i)//1 C/i C i (C/i)//1 C/i C i 1 break D.add(i) D.add D add i C /= i C i if C != 1:
    D.add(int(C)) C != 1 C 1 D.add(int(C)) D.add D add int(C) int C print(len(D)+1) print len(D)+1 len(D) len D 1 A,B = map(int,input().split()) map(int,input().split()) A E = deepcopy(C) deepcopy(C) E C /= i i C B = map(int,input().split()) map(int,input().split()) B C = gcd(A,B) gcd(A,B) C D = set() set() D
from math import *
from copy import deepcopy
A,B = map(int,input().split())
C = gcd(A,B)
E = deepcopy(C)
D = set()
for i in range(2,floor(sqrt(E))+1):
    while True:
        if C/i != (C/i)//1:
            break
        D.add(i)
        C /= i
if C != 1:
    D.add(int(C))
print(len(D)+1)