/*
Author: Arham_doshi
@quote "Apan isi back***di mai rehjayenge ,DA wale google lejayenge!"
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
#include <bits/stdc++.h>
using namespace std;
 
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
using namespace __gnu_pbds; 
 
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> data_set; 
#define fbo find_by_order
#define ook order_of_key
 
 
 
 
#define int         long long
#define double      long double
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define piiii       pair<pii,pii>
#define viiii       vector<pair<pii,pii>>
#define mi          map<int,int>
#define mii         map<pii,int>
#define piii           pair<int,pair<int,int> >
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define bs(v,n)     binary_search(all((v)),(n))
#define lb(v,n)     lower_bound(all((v)),(n))
#define ub(v,n)     upper_bound(all((v)),(n))
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define allfo(s)    for(auto it=(s).begin();it!=(s).end();it++)
#define _init(b)     memset(b,-1,sizeof(b))
#define _init0(b)     memset(b,0,sizeof(b))
#define MOD         1000000007
#define ef else if
 
 
 
 
 
int gcd(int a, int b) {  if (a == 0)  return b; return gcd(b % a, a); }  
bool mod(double a,double b) {return a/b - floor(a/b);}
 
int occurs(vi v,int n){
auto it=lb(v,n);auto it1=ub(v,n);int x=it1-it;return x;}
 
int logb(int base, int x) {
    return (log(x) / log(base));
}
void set_max(int &mx,int x){if(mx==-1||mx<x)mx=x;}
 
 
int power(int x,  int y, int p) 
{ 
    int res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res; 
} 
 
int mod_inv(int a,int m){
    a=a%m;
    return power(a,m-2,m)%MOD;
}
 
 
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
int fact[200005];
void count_fact(){
    int i,x=1;
    fact[0]=1;
    fo(i,1,200005){
        
        x=(x*i)%MOD;
      //  cout<<x<<" ";
        fact[i]=x;
        
    }
}
 
int ncr(int n,int r){
    int a=fact[n],b=fact[r],c=fact[n-r];
    
    return (a*mod_inv(b*c,MOD))%MOD;
   
}
 
 int prime[1000005];
vi  primes;
void SieveOfEratosthenes(int n) 
{
    memset(prime, -1, sizeof(prime)); 
    prime[0] = prime[1] = 0;
    int i,j;
    for (int p=2; p<=n; p++) 
    {
        if(prime[p]==-1){
            primes.pb(p);
            for(j=p;j<=n;j+=p){
                if(prime[j]==-1){prime[j]=p;}
            }
        }
    }
    
}

void prime_factors(int n){
   primes.clear();
   int i;
    
    int y=n,x;
    
     fo(i,0,primes.size()){
          x=primes[i];
          while(y%x==0){
              y/=x;
          }
      }
      if(y!=1)primes.pb(y);
      
}

 
 
 
 
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t,i,j,x,n,m,k,a,b;
 cin>>n;
 map<pii,int> mp;
 fo(i,1,n+1){
     string s;
     s=to_string(i);
     mp[{s[0]-'0',s[s.length()-1]-'0'}]++;
 }
 a=0;
 fo(i,0,10){
     fo(j,0,10){
         a+=mp[{i,j}]*mp[{j,i}];
     }
 }
 cout<<a;
    return 0;
}

Measured memory_bytes: 256