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()

def solve(n):

  tbl=[0]*100

  ans=0

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

    i=str(i)

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

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

    i=str(i)

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

  return ans

a=solve(N)

print(a)      
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()


def solve(n):
    tbl = [0] * 100
    ans = 0
    for i in range(1, n + 1):
        i = str(i)
        tbl[int(i[0] + i[-1])] += 1
    for i in range(1, n + 1):
        i = str(i)
        ans += tbl[int(i[-1] + i[0])]
    return ans


a = solve(N)
print(a)

-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 solve(n): +    tbl = [0] * 100 +    ans = 0 +    for i in range(1, n + 1): +        i = str(i) +        tbl[int(i[0] + i[-1])] += 1 +    for i in range(1, n + 1): +        i = str(i) +        ans += tbl[int(i[-1] + i[0])] +    return ans + + +a = solve(N) +print(a)