The Number of Subpermutations

CodeForces - 1175F