def next_Perfect_Square(N):
    if N < 0:
        return 0
    r = int(N ** 0.5)
    if r * r <= N:
        r += 1
    return r * r