#include<bits/stdc++.h>
#define ns "-1"
#define fs(i,x,y,z) for(register ll i=x;i<=y;i+=z)
#define ft(i,x,y,z) for(register ll i=x;i>=y;i+=z)
#define ll long long
#define ull unsigned long long
#define db double
#define ms(a,b) memset(a,b,sizeof(a))
#define sz(a) sizeof(a)
using namespace std;
const int rw[]={-1,0,1,0,-1,1,-1,1},cl[]={0,1,0,-1,-1,1,1,-1};
const int N=1000001,inf=0x3f3f3f3f;
inline ll read(){
ll date=0,w=1;char c=0;
while(c<'0'||c>'9'){if(c=='-')w=-1;c=getchar();}
while(c>='0'&&c<='9'){date=date*10+c-'0';c=getchar();}
return date*w;
}
ll phi[N],n,q,ans=1;
int main(){
n=read();
fs(i,2,n,1) phi[i]=i;
fs(i,2,n,1){
if(phi[i]==i){
fs(j,i,n,i) phi[j]=phi[j]/i*(i-1);
}
}
fs(i,2,n,1) ans+=phi[i];
printf("%lld",ans);
}