#include <iostream>
using namespace std;
int num = 2020;

int hcf(int i, int j)
{
    return (!j) ? i : hcf(j, i % j);
}

int main()
{
    int sum = 0;
    for (int i = 1; i <= num; i++)
    {
        for (int j = 1; j <= num; j++)
        {
            if (hcf(i, j) == 1)
                sum++;
        }
    }
    cout << sum;
    return 0;
}
