from math import gcd n = int(input()) ans = 0 for x in range(2, n): for y in range(x + 1, n + 1): if 1 < gcd(x, y) < x: ans += 1 print(ans)