global

def count_tree_routes(tree, count = 0)

def count_tree_routes(tree, count = 0)
  count += tree.routes.count
  if tree.children.length > 0
    return tree.children.map do |children|
      count_tree_routes(children, count)
    end.sum
  end
  return count
end