I have written some code for calculating a count of common factors. Please help me remove anything unnecessary and shorten it.

Please tell me if any function in Python 3 can calculate common factors directly!

```
# a string of 2 numbers
# is input e.g. '10 15'

a,b=str(input()).split(' ')
a,b=int(a),int(b)
n=0
if a>=b:
    lim=a
else:
    lim=b
for num in range(1,lim):
    if a%num==0 and b%num==0:
        n+=1
print(n)

```