nchains function

Number of Chains