def solve():

    N = int(eval(input()))



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

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

        ss = str(A)

        numss[int(ss[-1])][int(ss[0])] += 1



    ans = 0

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

        ss = str(A)

        ans += numss[int(ss[0])][int(ss[-1])]



    print(ans)



solve()

def solve():

    strN = eval(input())

    N = int(strN)



    maxD = len(strN)



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

    for x in range(1, 10):

        for y in range(1, 10):

            num = 0

            for d in range(1, maxD-2):

                num += 10**d

            if maxD-2 > 0:

                if x < int(strN[0]):

                    num += 10**(maxD-2)

                elif x == int(strN[0]):

                    num += int(strN[1:-1]) + 1

                    if y > int(strN[-1]):

                        num -= 1

            j = x*10 + y

            if 1 <= j <= N:

                num += 1

            if x == y:

                j = x

                if 1 <= j <= N:

                    num += 1

            numss[x][y] = num



    ans = 0

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

        ss = str(A)

        ans += numss[int(ss[-1])][int(ss[0])]



    print(ans)





solve()

def solve():
    N = int(eval(input()))
    numss = [[0] * (10) for _ in range(10)]
    for A in range(1, N + 1):
        ss = str(A)
        numss[int(ss[-1])][int(ss[0])] += 1
    ans = 0
    for A in range(1, N + 1):
        ss = str(A)
        ans += numss[int(ss[0])][int(ss[-1])]
    print(ans)


solve()

def solve():
    strN = eval(input())
    N = int(strN)
    maxD = len(strN)
    numss = [[0] * (10) for _ in range(10)]
    for x in range(1, 10):
        for y in range(1, 10):
            num = 0
            for d in range(1, maxD - 2):
                num += 10**d
            if maxD - 2 > 0:
                if x < int(strN[0]):
                    num += 10 ** (maxD - 2)
                elif x == int(strN[0]):
                    num += int(strN[1:-1]) + 1
                    if y > int(strN[-1]):
                        num -= 1
            j = x * 10 + y
            if 1 <= j <= N:
                num += 1
            if x == y:
                j = x
                if 1 <= j <= N:
                    num += 1
            numss[x][y] = num
    ans = 0
    for A in range(1, N + 1):
        ss = str(A)
        ans += numss[int(ss[-1])][int(ss[0])]
    print(ans)


solve()

-    N = int(eval(input())) +    strN = eval(input()) +    N = int(strN) +    maxD = len(strN) -    for A in range(1, N + 1): -        ss = str(A) -        numss[int(ss[-1])][int(ss[0])] += 1 +    for x in range(1, 10): +        for y in range(1, 10): +            num = 0 +            for d in range(1, maxD - 2): +                num += 10**d +            if maxD - 2 > 0: +                if x < int(strN[0]): +                    num += 10 ** (maxD - 2) +                elif x == int(strN[0]): +                    num += int(strN[1:-1]) + 1 +                    if y > int(strN[-1]): +                        num -= 1 +            j = x * 10 + y +            if 1 <= j <= N: +                num += 1 +            if x == y: +                j = x +                if 1 <= j <= N: +                    num += 1 +            numss[x][y] = num -        ans += numss[int(ss[0])][int(ss[-1])] +        ans += numss[int(ss[-1])][int(ss[0])]