#include
#include
#include
#include<unordered_map>
#include
#include
using namespace std;
typedef long long ll;
const int N = 40010; int primes[N], phi[N], cnt=0; bool str[N];
int get_eulers(int n)
{
phi[1] = 1;
for (int i = 2; i <= n / i; i++)
{
if (!str[i])
{
primes[cnt++] = i;
phi[i] = i - 1;
}
for (int j = 0; primes[j] <= n / i; j++)
{
str[primes[j] * i] = true;
if (i % primes[j] == 0)
{
phi[i * primes[j]] = phi[i] * primes[j];
break;
}
else
{
phi[i * primes[j]] = phi[i] * (primes[j] - 1);
}
}
}
ll res = 0;
for (int i : phi)res += phi[i];
return res;
}
int main()
{
int n;
cin >> n;
cout << get_eulers(n);
}