In order to keep any domesticated farm animals, other than hens, on your residential property, you need to have a minimum of three acres. The number of animals is limited by their size and the total acreage of your property (one-half acre for each sheep, goat, alpaca, llama, or similar small animal; three acres for each cow, donkey, horse, mule, or similar large animal).
You can have up to six hens per acre or fraction therof (e.g. a 1.7 acre lot can have up to 12 hens). Roosters are prohibited, so make sure that you buy only hens. Most hatcheries will refund or replace roosters that are accidentally missed in the sorting process (it not always easy to tell them apart as chicks). Hatching from eggs will almost certainly result in unwanted roosters. Contrary to popular belief, you do not need a rooster in order for hens to lay eggs and they may actually be grateful that you do not have one.
No animals can be housed and no manure can be stored within 20 feet of any property line or 150 feet from your front property line (not the curb or edge of street). You also need to keep manure piles away from inland wetlands and watercourses.