class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def count_leaf_nodes(root):
if root is None:
return 0
stack = []
stack.append(root)
count = 0
while stack:
node = stack.pop()
if node.left is None and node.right is None:
count += 1
if node.right:
stack.append(node.right)
if node.left:
_______________________
return count