<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described.
<END_TASK>
<USER_TASK:>
Description:
Number of solutions for the equation x + y + z <= n
function to find the number of solutions for the equation x + y + z <= n , such that 0 <= x <= X , 0 <= y <= Y , 0 <= z <= Z . ; to store answer ; for values of x ; for values of y ; maximum possible value of z ; if z value greater than equals to 0 then only it is valid ; find minimum of temp and z ; return required answer ; Driver code

<ASSISTANT_TASK:>
Python Code:
def NumberOfSolutions(x , y , z , n ) : 
	 ans = 0 
 for i in range(x + 1 ) : 
	 for j in range(y + 1 ) : 
	 temp = n - i - j 
 if temp >= 0 : 
	 temp = min(temp , z ) 
 ans += temp + 1 
    return ans 
  if __name__== "__main __": 
	 x , y , z , n = 1 , 2 , 3 , 4 
 print(NumberOfSolutions(x , y , z , n ) ) 
 
<END_TASK>
