def next_Perfect_Square(N):
    if N < 0:
        return 0

    root = int(N ** 0.5)
    if root * root <= N:
        root += 1

    return root * root