Generate code that has the following intention.

The intention of the program is to check if the number of opening parentheses ('(') in a given input string is equal to the number of closing parentheses (')'). The function p1(brackets) returns True if the number of parentheses is balanced, and False otherwise.