what formula should i use if i have two different ranges and i have to find a unique number in those?

For ex
in one range there are 7 digits out of 4 are 0

in in Second range there are also 7 digits, out of which 3 are 0

so pl let me knwo what formula should I use in that?