Let x be the number of counters in the bag.
Pr(red counter) is drawn first = 7/x
Pr(blue counter) is drawn first = (x-7)/x
Pr(counters will be same) = 8/15
with replacement:
P^req= 7/7+x × x/7+x= 7/15
so, the total number of counters in the bag before any counters are taken from the bag are 7/15.