I wrote a code as follows
f[n_] := n^2 + 1;
x = 10; y = 2 x; d = 2;
A = Table[f[n], {n, y - x + 1, y}];
A1[d_] := Select[A, Mod[#, d] == 0 &]
Sum[f[n], {f[n], A1[d]}]
Now I want to write the Mathematica code for the following double summation:
$$\Large \sum_{{1\le l\le d}\atop{f(l)\equiv 0,\bmod d}}\sum_{{Y-X< n\le X}\atop{n\equiv l,\bmod d}} 1$$
Please give a simple and elementary code that is not complicated or advanced.