human
Count array elements exceeding all previous elements as well as the next array element | Function to count array elements satisfying the given condition.
If there is only one array element.
Traverse the array.
Update the maximum element encountered so far.
Count the number of array elements strictly greater than all previous and immediately next elements.
Print the count.
Given array.
Size of the array"
How can the above be solved in Python?

Write me a code to count array elements exceeding all previous elements as well as the next array element and the other steps required?
assistant
#Here is code to count array elements exceeding all previous elements as well as the next array element and the other steps required.
 def numberOfIntegers ( arr , N ) :
	cur_max = 0
	count = 0
	if ( N == 1 ) :
		count = 1
	else :
		for i in range ( N - 1 ) :
			if ( arr [ i ] > cur_max ) :
				cur_max = arr [ i ]
				if ( arr [ i ] > arr [ i + 1 ] ) :
					count += 1
		if ( arr [ N - 1 ] > cur_max ) :
			count += 1
	print ( count )
arr = [ 1 , 2 , 0 , 7 , 2 , 0 , 2 , 0 ]
N = len ( arr )
numberOfIntegers ( arr , N )