from collections import defaultdict



def main():

    N = int(eval(input()))

    combs = [(S[0], S[-1]) for S in map(str, list(range(1, N+1)))]

    d = defaultdict(int)

    for pre, suf in combs:

        if suf != "0":

            d[(pre, suf)] += 1

            d[(suf, pre)]



    ans = 0

    for key, val in list(d.items()):

        pre, suf = key

        ans += val * d[(suf, pre)]

        

    print(ans)

if __name__ == "__main__":

    main()
from collections import defaultdict



def main():

    N = int(eval(input()))

    combs = [(S[0], S[-1]) for S in map(str, list(range(1, N+1)))]

    d = defaultdict(int)

    for pre, suf in combs:

        d[(pre, suf)] += 1

        d[(suf, pre)]



    ans = 0

    for key, val in list(d.items()):

        pre, suf = key

        ans += val * d[(suf, pre)]

        

    print(ans)

if __name__ == "__main__":

    main()
from collections import defaultdict


def main():
    N = int(eval(input()))
    combs = [(S[0], S[-1]) for S in map(str, list(range(1, N + 1)))]
    d = defaultdict(int)
    for pre, suf in combs:
        if suf != "0":
            d[(pre, suf)] += 1
            d[(suf, pre)]
    ans = 0
    for key, val in list(d.items()):
        pre, suf = key
        ans += val * d[(suf, pre)]
    print(ans)


if __name__ == "__main__":
    main()

from collections import defaultdict


def main():
    N = int(eval(input()))
    combs = [(S[0], S[-1]) for S in map(str, list(range(1, N + 1)))]
    d = defaultdict(int)
    for pre, suf in combs:
        d[(pre, suf)] += 1
        d[(suf, pre)]
    ans = 0
    for key, val in list(d.items()):
        pre, suf = key
        ans += val * d[(suf, pre)]
    print(ans)


if __name__ == "__main__":
    main()

-        if suf != "0": -            d[(pre, suf)] += 1 -            d[(suf, pre)] +        d[(pre, suf)] += 1 +        d[(suf, pre)]