local n=io.read("n")
local map={}
for i=1,n do
    local itos=tostring(i)
    local first=itos:byte(1)
    local last=itos:byte(#itos)
    map[first]=map[first] or {}
    map[first][last]=(map[first][last] or 0)+1
end

local counter=0
for first,_ in pairs(map) do
    for last,_ in pairs(map[first]) do
        if map[last] and map[last][first] then
            counter=counter+map[first][last]*map[last][first]
        end
    end
end
print(counter)