n = int(input()) phi = list(range(n + 1)) ans = n * (n - 1) // 2 for i in range(2, n + 1): if phi[i] == i: for j in range(i, n + 1, i): phi[j] -= phi[j] // i ans -= phi[i] + n // i - 1 print(ans)