def II(): return int(eval(input()))

N=II()

tbl=[0]*101

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

  i=str(i)

  tbl[int(str(i[0]+i[-1]))]+=1

ans=0

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

  i=str(i)

  ans+=tbl[int(str(i[-1]+i[0]))]

print(ans)

      
def II(): return int(eval(input()))

N=II()

tbl=[0]*101

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

  i=str(i)

  tbl[int(i[0]+i[-1])]+=1

ans=0

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

  i=str(i)

  ans+=tbl[int(i[-1]+i[0])]

print(ans)

      
def II():
    return int(eval(input()))


N = II()
tbl = [0] * 101
for i in range(1, N + 1):
    i = str(i)
    tbl[int(str(i[0] + i[-1]))] += 1
ans = 0
for i in range(1, N + 1):
    i = str(i)
    ans += tbl[int(str(i[-1] + i[0]))]
print(ans)

def II():
    return int(eval(input()))


N = II()
tbl = [0] * 101
for i in range(1, N + 1):
    i = str(i)
    tbl[int(i[0] + i[-1])] += 1
ans = 0
for i in range(1, N + 1):
    i = str(i)
    ans += tbl[int(i[-1] + i[0])]
print(ans)

-    tbl[int(str(i[0] + i[-1]))] += 1 +    tbl[int(i[0] + i[-1])] += 1 -    ans += tbl[int(str(i[-1] + i[0]))] +    ans += tbl[int(i[-1] + i[0])]