function Main(arg)
{
  var N = arg.split("\n")[0]-0;
 
  var ans = 0;
  var num = N.toString().length;

  for (var i = 1; i <= N; i++){
    var a = i.toString()[0];
    var b = i.toString()[i.toString().length-1];
    for (var j = 1; j <= N; j++){
      var c = j.toString()[0];
      var d = j.toString()[j.toString().length-1];
      if (a === d && b === c) {
        ans++;
      }
    }
  }

  console.log(ans);
  return;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));