In what follows $[\cdot]$ means approximation to the nearest integer.
Consider
$\gamma_w\in (0,\infty)$
some i.i.d. real valued random variables $X_i$ $\forall i \in \mathbb{N}$, each with support $\mathcal{X}$
a sequence of real valued random variables $\{Y_n\}_{n\in \mathbb{N}}$, with $Y_n\in [0,[n\exp(\gamma_w)]]$
a function $g:\mathbb{R}\rightarrow \mathbb{R}$, $g$ could be monotone or not, continuous or not, etc. However, we know that $g(x)\leq \bar{U}\in (0,\infty)$ $\forall x \in \mathbb{R}$
a function $f_n:\mathbb{R}\rightarrow \mathbb{R}$ with $f_n(x)\equiv \frac{\exp(g(x))}{1+\frac{1}{[\sqrt{n}]} \exp(g(x))}$
Assume that $$ (\star) \hspace{1cm}\Big| E(Y_n| X_1,..., X_n) - \frac{1}{[\sqrt{n}]} \sum_{i=1}^{[n\exp(\gamma_w)]} f_n(X_i)\Big| \rightarrow_{a.s.} 0 \text{ as $n\rightarrow \infty$} $$ and (which can be shown using the assumptions above) $$ (\star\star) \hspace{1cm} \frac{1}{[\sqrt{n}]} \sum_{i=1}^{[n\exp(\gamma_w)]} f_n(X_i) \leq \frac{1}{[\sqrt{n}]}[n\exp(\gamma_w)] \exp(\bar{U}) $$
Could you help me to show that $E(Y_n)\leq \sqrt{n}(\exp(\bar{U}+\gamma_w)+r_n)$ where $r_n$ converges to $0$ as $n\rightarrow \infty$?
Other details: The exercise suggests to notice that the upper bound in $(\star \star)$ does not depend on $X_1,..., X_n$ and to apply the Law of Iterated Expectations (LIE). I'm confused because when applying LIE to $(\star)$ the region of integration increases with $n$ (it is indeed $\mathcal{X}^n$).
EDIT: I have worked more on $(\star \star)$ $$ \frac{1}{[\sqrt{n}]}[n\exp(\gamma_w)] \exp(\bar{U})\leq \frac{1}{[\sqrt{n}]}(n\exp(\gamma_w)+1) \exp(\bar{U})\leq \frac{1}{\sqrt{n}-1}(n\exp(\gamma_w)+1)\exp(\bar{U})=\\ \frac{n}{\sqrt{n}-1} \exp(\bar{U}+\gamma_w)+\frac{\exp(\bar{U})}{{\sqrt{n}-1}}\leq ?? $$