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(); int[][int] sd; foreach(int xe; X) { sd[(xe*10^^9)%D] ~= (xe*10^^9)/D; } //writeln(sd); long ans = 0; foreach(int[] 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); }