import std.algorithm, std.array, std.container, std.range, std.bitmanip; import std.numeric, std.math, std.bigint, std.random; import std.string, std.conv, std.stdio, std.typecons; struct range { long s; long e; } void main() { auto rd = readln.split.map!(to!long); auto n = rd[0], d = rd[1], t = rd[2]; auto xi = readln.split.map!(to!long).array; xi.sort(); long[][long] aij; foreach (x; xi) { if (x % d == 0 || x >= 0) aij[x % d] ~= x / d; else aij[x % d + d] ~= x / d - 1; } auto bij = aij.values; auto cij = bij.map!((bi) { range[] di; foreach (b; bi) { auto e = range(b - t, b + t); if (di.empty || di.back.e < e.s) di ~= e; else di.back.e = e.e; } return di; }).array; auto r = cij.map!(ci => ci.map!(c => c.e - c.s + 1).sum).sum; writeln(r); }