from collections import defaultdict as d

dic=d(int)

for i in range(1,int(eval(input()))+1):

  dic[(int(str(i)[0]),i%10)]+=1

ans=0

for i in range(10):

  for j in range(10):

    ans+=dic[(i,j)]*dic[(j,i)]

print(ans)
import sys

readline = sys.stdin.readline



N = int(readline())



from collections import defaultdict

dic = defaultdict(int)



for i in range(1, N + 1):

  s = str(i)

  dic[(int(s[0]),int(s[-1]))] += 1

  

ans = 0

for i in range(1, 10):

  for j in range(1, 10):

    ans += dic[(i,j)] * dic[(j,i)]

    

print(ans)
from collections import defaultdict as d

dic = d(int)
for i in range(1, int(eval(input())) + 1):
    dic[(int(str(i)[0]), i % 10)] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += dic[(i, j)] * dic[(j, i)]
print(ans)

import sys

readline = sys.stdin.readline
N = int(readline())
from collections import defaultdict

dic = defaultdict(int)
for i in range(1, N + 1):
    s = str(i)
    dic[(int(s[0]), int(s[-1]))] += 1
ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += dic[(i, j)] * dic[(j, i)]
print(ans)

-from collections import defaultdict as d +import sys -dic = d(int) -for i in range(1, int(eval(input())) + 1): -    dic[(int(str(i)[0]), i % 10)] += 1 +readline = sys.stdin.readline +N = int(readline()) +from collections import defaultdict + +dic = defaultdict(int) +for i in range(1, N + 1): +    s = str(i) +    dic[(int(s[0]), int(s[-1]))] += 1 -for i in range(10): -    for j in range(10): +for i in range(1, 10): +    for j in range(1, 10):