from bisect import bisect_left, bisect_right n, d = map(int, input().split()) L = [] for w in range(1, n + 1): for z in range(1, n + 1): L.append(w**2 - z**2) L.sort() ans = 0 for x in range(1, n + 1): for y in range(1, n + 1): res = x**2 + y**2 - d ans += bisect_right(L, res) - bisect_left(L, res) print(ans)