N = int(input()) def sosuu(n): for i in range(2, n): if n % i == 0: return False return True num = [] for i in range(2, N): if sosuu(i): num.append(i) print(num) ans = 0 for p in range(len(num)): for q in range(len(num)): for r in range(len(num)): if (num[p] + num[q]) == num[r] ** 2: ans += 1 print(ans)