/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <fstream>
using namespace std;
bool f(long a,long b);
int main()
{
long n,i,j,s;
ifstream fin("fractii.in");
fin >>n;
fin.close();
s=2*n-1;
for(i=2;i<n;i++)
for(j=i+1;j<=n;j++)
if(j%i!=0)
if (f(i,j)==true)
s+=2;
ofstream fout("fractii.out");
fout <<s;
fout.close();
return 0;
}
bool f(long a,long b)
{
while(a!=b)
if(a>b)
a-=b;
else
b-=a;
return a==1;
}