Modified logic for calculating bridge count