local n = io.read("*n")
local t = {}
for i = 1, 81 do
  t[i] = 0
end
for i = 1, n do
  local ri = i
  local btm = i % 10
  if btm ~= 0 then
    local top = btm
    while 10 <= i do
      i = i // 10
    end
    local top = i
    local idx = (top - 1) * 9 + btm
    t[idx] = t[idx] + 1
  end
end
local ret = 0
for i = 1, 9 do
  local idx = (i - 1) * 9 + i
  for j = 1, 9 do
    local idx1, idx2 = (i - 1) * 9 + j, (j - 1) * 9 + i
    ret = ret + t[idx1] * t[idx2]
  end
end
print(ret)
