If there are R red cards and B black cards, then the number of ways to draw a matching pair is (R^2-R)/2 + (B^2-B)/2 and the number of ways to draw a pair of mismatched cards is R*B.
For the probability of a mismatched pair to be 50%, then the two expressions must be equal. Then (R^2-R)/2 + (B^2-B)/2 = R*B
This equation can be rearranged as (R-B)^2 = R+B. If N = R-B then N^2 = R+B. Then R = (N^2+N)/2 and B = (N^2-N)/2.
The largest value of N which has R and B not exceeding 26 is N=6. Then R=21 and B=15, so the smallest number of cards that need to be removed is (26-21) + (26-15) = 16.