If I understand you correctly then you can try the library object Master page n of m which I think does want you want:
When you place it on your Master page you get the page x of y, y=number of sheets on this masterpage.
Current page is this.rawValue = this.parent.index + 1;
Number of pages on Masterpage: this.rawValue = this.parent.all.length;