import std.stdio, std.string, std.conv ,std.array,std.algorithm, std.range ,std.math; void main(){ auto buf = readln().strip().split().map!(to!int)(); immutable int N = buf[0]; immutable int D = buf[1]; immutable int T = buf[2]; auto x = readln().strip().split().map!(to!int)(); auto X = x.array.sort(); long[][int] sd; foreach(long xe; X) { int r = xe % D; int modr = r<0 ? r + D : r; sd[modr] ~= xe/D; } //writeln(sd); long ans = 0; foreach(long[] s; sd) { ans += s.length * (2 * T + 1); //writeln(ans); foreach(immutable int i; 0 .. s.length.to!int - 1) { if(s[i] + T >= s[i+1] - T) { ans -= s[i] + T - (s[i+1] - T) + 1; } } } writeln(ans); }