import sys

import numpy as np



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



N = ir()

# Aの先頭の桁と末尾の桁の組み合わせは9*10=90通りだけ

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

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

    x = str(x)

    i = int(x[0])

    j = int(x[-1])

    table[i][j] += 1



table = np.array(table)

answer = (table * table.T).sum()

print(answer)

import sys



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



N = ir()

count = [[0] * 10 for _ in range(10)] # dp[head][tail]

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

    s = str(i)

    head = int(s[0]); tail = int(s[-1])

    count[head][tail] += 1



answer = 0

for h in range(10):

    for t in range(10):

        answer += count[h][t] * count[t][h]

print(answer)

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
# Aの先頭の桁と末尾の桁の組み合わせは9*10=90通りだけ
table = [[0] * 10 for i in range(10)]
for x in range(1, N + 1):
    x = str(x)
    i = int(x[0])
    j = int(x[-1])
    table[i][j] += 1
table = np.array(table)
answer = (table * table.T).sum()
print(answer)

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
count = [[0] * 10 for _ in range(10)]  # dp[head][tail]
for i in range(1, N + 1):
    s = str(i)
    head = int(s[0])
    tail = int(s[-1])
    count[head][tail] += 1
answer = 0
for h in range(10):
    for t in range(10):
        answer += count[h][t] * count[t][h]
print(answer)

-import numpy as np -# Aの先頭の桁と末尾の桁の組み合わせは9*10=90通りだけ -table = [[0] * 10 for i in range(10)] -for x in range(1, N + 1): -    x = str(x) -    i = int(x[0]) -    j = int(x[-1]) -    table[i][j] += 1 -table = np.array(table) -answer = (table * table.T).sum() +count = [[0] * 10 for _ in range(10)]  # dp[head][tail] +for i in range(1, N + 1): +    s = str(i) +    head = int(s[0]) +    tail = int(s[-1]) +    count[head][tail] += 1 +answer = 0 +for h in range(10): +    for t in range(10): +        answer += count[h][t] * count[t][h]