Using for, but in the opposite direction, I do not test, but I think that it is faster.
xx <- c(8, 1, 10, 3, 9, 7, 4, 5, 6, 2)
res = vector('integer',length=length(xx))
for (i in rev(seq_along(xx))) {
res[i] <- sum(xx[i]>=xx)
xx <- xx[-i]
}
res
[1] 1 1 3 2 4 3 3 4 5 2