We introduce a long-period generic spatial modulation into a typical model of the Thouless pump, namely, the Rice--Mele (RM) model, to examine the lattice analog of the fermion charge in quantum field theory. We derive a Diophantine equation relating the fermion charge and the pumped charge, which leads to the one-dimensional (1D) analog of the Streda formula in the quantum Hall effect (QHE). This formula implies that an adiabatic change of the periodicity of the spatial modulation yields a spatial charge pump such that the rightmost charge is pumped to the right by the Chern number compared with the leftmost charge. This causes a change in the length of the fermion chain by an integer, thus providing the opportunity for direct measurement of the Streda formula in 1D systems.