#import <Foundation/Foundation.h>
int main(){
    int N;
    scanf("%d",&N);
    NSMutableArray *B = [NSMutableArray array];
    for(int i=0;i<N;i++){
        int b;
        scanf("%d",&b);
        if(b>i+1) {
            puts("-1");
            return 0;
        }
        [B addObject:@(b)];
    }
    NSMutableArray *result = [NSMutableArray array];
    while([B count]>0){
        for(int i=[B count]-1;i>=0;i--){
            if(i+1==[[B objectAtIndex:i] integerValue]) {
                [result insertObject:@(i+1) atIndex:0];
                [B removeObjectAtIndex:i];
                break;
            }
        }
    }
    printf("%s", [result componentsJoinedByString:@"\n"].UTF8String);
}
