  In this work, we study the thermodynamic topology of a static, a charged
static and a charged, rotating black hole in $f(R)$ gravity. For charged static
black holes, we work in two different ensembles: fixed charge$(q)$ ensemble and
fixed potential$(\phi)$ ensemble. For charged, rotating black hole, four
different types of ensembles are considered: fixed $(q, J)$, fixed $(\phi, J)$,
fixed $(q,\Omega)$ and fixed $(\phi,\Omega)$ ensemble, where $J$ and $\Omega$
denotes the angular momentum and the angular frequency respectively. Using the
generalized off-shell free energy method, where the black holes are treated as
topological defects in their thermodynamic spaces, we investigate the local and
global topology of these black holes via the computation of winding numbers at
these defects. For static black hole we work in three model. We find that the
topological charge for a static black hole is always $-1$ regardless of the
values of the thermodynamic parameters and the choice of $f(R)$ model. For a
charged static black hole, in the fixed charge ensemble, the topological charge
is found to be zero. Contrastingly, in the fixed $\phi$ ensemble, the
topological charge is found to be $-1.$ For charged static black holes, in both
the ensembles, the topological charge is observed to be independent of the
thermodynamic parameters. For charged, rotating black hole, in fixed $(q, J)$
ensemble, the topological charge is found to be $1.$ In $(\phi, J)$ ensemble,
we find the topological charge to be $1.$ In case of fixed $(q,\Omega)$
ensemble, the topological charge is $1$ or $0$ depending on the value of the
scalar curvature($R$). In fixed $(\Omega,\phi)$ ensemble, the topological
charge is $-1,0$ or $1$ depending on the values of $R,\Omega$ and $\phi.$
