N=int(input()) ans=0 for a in range(10): for b in range(10): if a==b: continue l,r=0,10**10 while r-l>1: mid=(l+r)//2 if mid**2-a*N*mid-1-b*N<0: l=mid else: r=mid if max(a,b)+1<=l: ans+=l-max(a,b) print(ans)