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);
});

reader.on('close', () => {
  var x = 1*lines[0]

  var cnt = 0;
  for(var i=1;i<=x;i++){
      for(var j=1;j<=x;j++){
        var ii = "" + i;
        var jj = "" + j;
        if(ii.slice( 0, 1 ) == jj.slice( -1 ) && jj.slice( 0, 1 ) == ii.slice( -1 )){
      ++cnt
      }

    }
  }
  console.log(cnt)



  
});
