#!/usr/bin/env python3
import sys


def solve(N: int):
    l = len(str(N))
    k = {}
    for i in range(1,10):
        for j in range(1,10):
            k[str(i)+str(j)] = 0
    for x in range(1, N+1):
        s = str(x)
        if s[-1] != "0":
            k[s[0]+s[-1]] += 1

    k_new = {}
    for i in range(1,10):
        k_new[str(i)+str(i)] = k[str(i)+str(i)]**2
        for j in range(i+1,10):
            n = k[str(i)+str(j)] * k[str(j)+str(i)]
            k_new[str(i)+str(j)] = n * 2

    # print(k_new)
    print(sum([t for t in k_new.values()]))

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()
