def main():

    n = int(eval(input()))

    import numpy as np

    ans = np.zeros((10,10))

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

        h,t = str(i)[0],str(i)[-1]

        ans[int(h)-1][int(t)-1]+=1

    s = 0

    for i in range(10):

        for j in range(10):

            s += ans[i][j]*ans[j][i]



    print((int(s)))

if __name__ == "__main__":

    main()
def main():

    n = int(eval(input()))

    dp = [[0 for i in range(10)] for i in range(10)]

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

        h,t = int(str(i)[0]), int(str(i)[-1])

        dp[h][t] += 1

    ans = 0

    for i in range(10):

        for j in range(10):

            ans += dp[i][j] * dp[j][i]

    print(ans)



if __name__ == "__main__":

    main()

def main():
    n = int(eval(input()))
    import numpy as np

    ans = np.zeros((10, 10))
    for i in range(1, n + 1):
        h, t = str(i)[0], str(i)[-1]
        ans[int(h) - 1][int(t) - 1] += 1
    s = 0
    for i in range(10):
        for j in range(10):
            s += ans[i][j] * ans[j][i]
    print((int(s)))


if __name__ == "__main__":
    main()

def main():
    n = int(eval(input()))
    dp = [[0 for i in range(10)] for i in range(10)]
    for i in range(1, n + 1):
        h, t = int(str(i)[0]), int(str(i)[-1])
        dp[h][t] += 1
    ans = 0
    for i in range(10):
        for j in range(10):
            ans += dp[i][j] * dp[j][i]
    print(ans)


if __name__ == "__main__":
    main()

-    import numpy as np - -    ans = np.zeros((10, 10)) +    dp = [[0 for i in range(10)] for i in range(10)] -        h, t = str(i)[0], str(i)[-1] -        ans[int(h) - 1][int(t) - 1] += 1 -    s = 0 +        h, t = int(str(i)[0]), int(str(i)[-1]) +        dp[h][t] += 1 +    ans = 0 -            s += ans[i][j] * ans[j][i] -    print((int(s))) +            ans += dp[i][j] * dp[j][i] +    print(ans)