import sys

sys.setrecursionlimit(1000000000)

import math

from fractions import gcd

from itertools import count, permutations

from functools import lru_cache

from collections import deque, defaultdict

from pprint import pprint

ii = lambda: int(eval(input()))

mis = lambda: list(map(int, input().split()))

lmis = lambda: list(mis())

INF = float('inf')

N1097 = 10**9 + 7



def meg(f, ok, ng):

    while abs(ok-ng)>1:

        mid = (ok+ng)//2

        if f(mid):

            ok=mid

        else:

            ng=mid

    return ok

#



def main():

    N=ii()

    d = defaultdict(int)

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

        i = str(i)

        a, b = i[0], i[-1]

        if a != 0 != b:

            d[(a, b)] += 1

    ans = 0

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

        i = str(i)

        a, b = i[0], i[-1]

        ans += d[(b, a)]

    print(ans)





main()

import sys

sys.setrecursionlimit(1000000000)

import math

from fractions import gcd

from itertools import count, permutations

from functools import lru_cache

from collections import deque, defaultdict

from pprint import pprint

ii = lambda: int(eval(input()))

mis = lambda: list(map(int, input().split()))

lmis = lambda: list(mis())

INF = float('inf')

N1097 = 10**9 + 7



def meg(f, ok, ng):

    while abs(ok-ng)>1:

        mid = (ok+ng)//2

        if f(mid):

            ok=mid

        else:

            ng=mid

    return ok

#



def main():

    N=ii()

    d = defaultdict(int)

    for i in map(str, list(range(1, N+1))):

        i = str(i)

        a, b = i[0], i[-1]

        d[(a, b)] += 1

    print((sum(d[(a, b)] * d[(b, a)] for a in map(str, list(range(1,9+1))) for b in map(str, list(range(1,9+1))))))



main()

import sys

sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

ii = lambda: int(eval(input()))
mis = lambda: list(map(int, input().split()))
lmis = lambda: list(mis())
INF = float("inf")
N1097 = 10**9 + 7


def meg(f, ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if f(mid):
            ok = mid
        else:
            ng = mid
    return ok


#
def main():
    N = ii()
    d = defaultdict(int)
    for i in range(1, N + 1):
        i = str(i)
        a, b = i[0], i[-1]
        if a != 0 != b:
            d[(a, b)] += 1
    ans = 0
    for i in range(1, N + 1):
        i = str(i)
        a, b = i[0], i[-1]
        ans += d[(b, a)]
    print(ans)


main()

import sys

sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

ii = lambda: int(eval(input()))
mis = lambda: list(map(int, input().split()))
lmis = lambda: list(mis())
INF = float("inf")
N1097 = 10**9 + 7


def meg(f, ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if f(mid):
            ok = mid
        else:
            ng = mid
    return ok


#
def main():
    N = ii()
    d = defaultdict(int)
    for i in map(str, list(range(1, N + 1))):
        i = str(i)
        a, b = i[0], i[-1]
        d[(a, b)] += 1
    print(
        (
            sum(
                d[(a, b)] * d[(b, a)]
                for a in map(str, list(range(1, 9 + 1)))
                for b in map(str, list(range(1, 9 + 1)))
            )
        )
    )


main()

-    for i in range(1, N + 1): +    for i in map(str, list(range(1, N + 1))): -        if a != 0 != b: -            d[(a, b)] += 1 -    ans = 0 -    for i in range(1, N + 1): -        i = str(i) -        a, b = i[0], i[-1] -        ans += d[(b, a)] -    print(ans) +        d[(a, b)] += 1 +    print( +        ( +            sum( +                d[(a, b)] * d[(b, a)] +                for a in map(str, list(range(1, 9 + 1))) +                for b in map(str, list(range(1, 9 + 1))) +            ) +        ) +    )