// Original C++ solution (slower):
#include <iostream>

#include <cmath>



using namespace std;



int get_head(int a){

    return a / int(pow(10, int(log10(a))));

}



int num( int a, int b, int N){

    int ans = 0;

    for(int i=1; i<=N; i++){

        if(get_head(i) == a && i%10 == b) {

            ans ++;

            i+= 9;

        }

    }

    return ans;

}



int main(){

    int N;

    cin >> N;

    int d[100];

    for(int i=1; i<10; i++){

        for(int j=1; j<10; j++){

            d[i*10 + j] = num(i, j, N);

        }

    }

    long ans = 0;

    for(int i=1; i<10; i++){

        for(int j=1; j<10; j++){

            ans += long(d[i*10 + j]) * long(d[j*10 + i]);

        }

    }

    cout << ans << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <cmath>



using namespace std;



int get_head(int a){

    return a / int(pow(10, int(log10(a))));

}



int num( int a, int b, int N){

    int ans = 0;

    for(int i=1; i<=N; i++){

        if(get_head(i) == a && i%10 == b) {

            ans ++;

            i+= 9;

        }

    }

    return ans;

}



int main(){

    int N;

    cin >> N;

    int d[100];

    for(int i=1; i<10; i++){

        for(int j=1; j<10; j++){

            d[i*10 + j] = 0;

        }

    }

    for(int i=1; i<=N; i++){

        d[10 * get_head(i) + i%10]++;

    }

    long ans = 0;

    for(int i=1; i<10; i++){

        for(int j=1; j<10; j++){

            ans += long(d[i*10 + j]) * long(d[j*10 + i]);

        }

    }

    cout << ans << endl;

    return 0;

}

// Fastest known solution for this problem:
/*

confirm 0LL and 1LL

confirm cornercases such as 0

confirm times of cin < 10^6

*/

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using ld = long double;

using P = pair<ll, ll>;

using Pld = pair<ld, ld>;

using Vec = vector<ll>;

using VecP = vector<P>;

using VecB = vector<bool>;

using VecC = vector<char>;

using VecD = vector<ld>;

using VecS = vector<string>;

using VecVec = vector<Vec>;

using Tree = vector<VecP>;

template <typename T>

using Vec1 = vector<T>;

template <typename T>

using Vec2 = vector<Vec1<T> >;

#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))

#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))

#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))

#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))

#define rep(i, n) REP(i, 0, n)

#define repn(i, n) REPN(i, 1, n)

#define repr(i, n) REPR(i, n, 0)

#define repnr(i, n) REPNR(i, n, 1)

#define all(s) (s).begin(), (s).end()

#define pb push_back

#define mp make_pair

#define fs first

#define sc second

template <typename T>

bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}

template <typename T>

bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}

template <typename T>

void co(const T n){cout << n << endl;}

template <typename T>

void cosp(const T n){cout << n << ' ';}

void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}

void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}

void setp(const ll n){cout << fixed << setprecision(n);}

const ll INF = 1e9+1;

const ll LINF = 1e18+1;

const ll MOD = 1e9+7;

//const ll MOD = 998244353;

const ld PI = acos(-1);

const ld EPS = 1e-11;



int main(void){

	ll n;

	cin >> n;



	VecVec c(10, Vec(10));



	repn(i, n){

		string s = to_string(i);

		ll a = s[0]-'0', b = s[s.size()-1]-'0';

		c[a][b]++;

	}



	ll ans = 0;

	rep(i, 10){

		rep(j, 10) ans += c[i][j]*c[j][i];

	}

	co(ans);



	return 0;

}