#!/usr/bin/env python3 import sys def main(): N = int(input()) s = set() for i in range(2 * 10 ** 5 + 1): s.add(i ** 2) ans = 0 for x in s: if N - x in s: ans += 1 print(ans) if __name__ == '__main__': main()