It's not based on number of connections, but instead a computed value known as "drainage fixture units".
2012 International Residential Code
SECTION P3004 DETERMINING DRAINAGE FIXTURE UNITS
P3004.1 DWV system load. The load on DWV-system piping shall be computed in terms of drainage fixture unit (d.f.u.) values in accordance with Table P3004.1.
SECTION P3005 DRAINAGE SYSTEM
P3005.4.1 Branch and stack sizing. Branches and stacks shall be sized in accordance with Table P3005.4.1. Below grade drain pipes shall be not less than 11/2 inches (38 mm) in diameter. Drain stacks shall be not smaller than the largest horizontal branch connected.
1. A 4-inch by 3-inch (102 mm by 76 mm) closet bend or flange.
2. A 4-inch (102 mm) closet bend connected to a 3-inch (76 mm) stack tee shall not be prohibited.
P3005.4.2 Building drain and sewer size and slope. Pipe sizes and slope shall be determined from Table P3005.4.2 on the basis of drainage load in fixture units (d.f.u.) computed from Table P3004.1.
It seems that you are doing quite a bit of plumbing, and that you may not have all the knowledge required to do the work yourself. It might be a good idea to contact a local licensed Plumber, as they will be familiar with your local codes.