human
Count the elements having frequency equals to its value | Function to find the count.
Hash map for counting frequency.
Counting freq of each element.
Check if value equals to frequency and increment the count.
Driver code.
Function call"
How can the above be solved in Python?
 Can you provide a code to count the elements having frequency equals to its value and the other steps required?
assistant
#Here is code to count the elements having frequency equals to its value and the other steps required.
 def find_maxm ( arr , n ) :
	mpp = { }
	for i in range ( 0 , n ) :
		if arr [ i ] in mpp :
			mpp [ arr [ i ] ] = mpp [ arr [ i ] ] + 1
		else :
			mpp [ arr [ i ] ] = 1
	ans = 0
	for key in mpp :
		value = key
		freq = mpp [ key ]
		if value == freq :
			ans = ans + 1
	return ans
if __name__ == " _ _ main _ _ " :
	arr = [ 3 , 2 , 2 , 3 , 4 , 3 ]
	n = len ( arr )
	print ( find_maxm ( arr , n ) )