function main(input) {
  var N = input[0]-0;
  var map = {};
  for(var i=1;i<=N;i++){
    var str = i.toString();
    var start = str[0];
    var end = str[str.length-1];
    if(end=="0") continue;
    var key = start + "_" + end;
    map[key] = (map[key]||0)+1;
  }
  var ans = 0;
  Object.keys(map).forEach(key=>{
    var start = key.split("_")[0];
    var end = key.split("_")[1];
    ans += map[key]*(map[end+"_"+start]?map[end+"_"+start]:0);
  });
  console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));
