Nicky had 30 more baseball cards than Diego. They had 90 baseball cards altogether. When Diego lost some baseball cards, Nicky had 3 times as many as Diego. How many baseball cards had Diego lost?

n = d+30

n+d = 90
solve for n and d

n = 3(d-x)
plug in n and d, then solve for x