process.stdin.resume();
process.stdin.setEncoding('utf8');
 
var lines = [];
var reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});
reader.on('line', (line) => {
    // ここで入力を処理する
    lines.push(line);
});
var sub_fn = (ary)=>{
  
}
reader.on('close', () => {
  var x = 1*lines[0].split(' ')[0]
  var y = lines[0].split('')
  //console.log(x)
  var cnt = 0;
  for(var i=1;i<=x;i++){
    var ii = ("" + i).split('');
    //console.log(ary)
   // console.log(ary[0] == ary[ary.length - 1])
    
      for(var j=1;j<=x;j++){
    var jj = ("" + j).split('');
          if(ii[0] == jj[jj.length - 1] && ii[ii.length - 1] == jj[0]){
      ++cnt
      }

    }
  }
  console.log(cnt)



  
});
