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 = np.zeros((10, 10)).astype(int)

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

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
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 = np.zeros((10, 10)).astype(int)
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
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)

-table = np.zeros((10, 10)).astype(int) +table = [[0] * 10 for i in range(10)]