The total EV you can gain is still 510. The only difference is that the max amount of EV you can have in ONE stat is changed from 255 to 252.

The case scenario where your 510 EV total will be changed to 504 is when:

You have 255 EVs in two stats. This is when the extra 3 EVs in both stats are removed to satisfy the new max of 252 in one stat. This 6 EVs can then be invested in another stat.

If you have the typical 252/252/4 spread, which is at 508 EVs, even after transfer, the EV total remains unchanged.

Hope that you understand my explanation (I am quite lousy in explaining) and I managed to be of help to you. :)

Source: Experience