This can be archived by using :-ro-nth(An+B) pseudo-class with A being -1 and B being the number of pages that should be selected.


Example:

Select the first four pages and remove their page margin

@page :-ro-nth(-1n+4) {
    margin: 0;
}