unittest
{
	assert( [ "25" ].solve == 17 );
	assert( [ "1" ].solve == 1 );
	assert( [ "100" ].solve == 108 );
	assert( [ "2020" ].solve == 40812 );
	assert( [ "200000" ].solve == 400000008 );
}



import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	
	// 先頭の桁と末尾の桁ごとに集計
	auto css = new long[][]( 10, 10 );
	foreach( i; 1L .. n + 1 )
	{
		auto j = i % 10;
		while( 10 <= i ) i /= 10;
		css[ i ][ j ]++;
	}
	
	// ペアの数をカウント
	auto ans = 0L;
	foreach( i; 1L .. 10L )
	{
		foreach( j; 1L .. 10L )
		{
			ans += css[ i ][ j ] * css[ j ][ i ];
		}
	}
	return ans;
}
