code to count number of regulation