n = int(eval(input()))



c=[[0]*10 for i in range(10)]

for k in range(1,n+1):

  k=str(k)

  i=int(k[0])

  j=int(k[-1])

  c[i][j]+=1

  

ans=0

for i in range(10):

  for j in range(10):

    ans+=c[i][j]*c[j][i]

print(ans)
MOD = 10 ** 9 + 7

INF = 10 ** 11

import sys

sys.setrecursionlimit(100000000)



def main():

    N = int(eval(input()))

    presuf = [[0] * 10 for _ in range(10)]

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

        pre = int(str(i)[0])

        suf = i%10

        presuf[pre][suf] += 1

    

    ans = 0

    for i in range(10):

        for j in range(10):

            ans += presuf[i][j]*presuf[j][i]

    print(ans)

if __name__ == '__main__':

    main()

n = int(eval(input()))
c = [[0] * 10 for i in range(10)]
for k in range(1, n + 1):
    k = str(k)
    i = int(k[0])
    j = int(k[-1])
    c[i][j] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += c[i][j] * c[j][i]
print(ans)

MOD = 10**9 + 7
INF = 10**11
import sys

sys.setrecursionlimit(100000000)


def main():
    N = int(eval(input()))
    presuf = [[0] * 10 for _ in range(10)]
    for i in range(1, N + 1):
        pre = int(str(i)[0])
        suf = i % 10
        presuf[pre][suf] += 1
    ans = 0
    for i in range(10):
        for j in range(10):
            ans += presuf[i][j] * presuf[j][i]
    print(ans)


if __name__ == "__main__":
    main()

-n = int(eval(input())) -c = [[0] * 10 for i in range(10)] -for k in range(1, n + 1): -    k = str(k) -    i = int(k[0]) -    j = int(k[-1]) -    c[i][j] += 1 -ans = 0 -for i in range(10): -    for j in range(10): -        ans += c[i][j] * c[j][i] -print(ans) +MOD = 10**9 + 7 +INF = 10**11 +import sys + +sys.setrecursionlimit(100000000) + + +def main(): +    N = int(eval(input())) +    presuf = [[0] * 10 for _ in range(10)] +    for i in range(1, N + 1): +        pre = int(str(i)[0]) +        suf = i % 10 +        presuf[pre][suf] += 1 +    ans = 0 +    for i in range(10): +        for j in range(10): +            ans += presuf[i][j] * presuf[j][i] +    print(ans) + + +if __name__ == "__main__": +    main()