#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define BET(a,b,c) ((a)<=(b)&&(b)<(c)) #define FOR(i,n) for(int i=0,i##_end=(int(n));i VI; typedef vector VVI; int main() { int N,D,T; cin>>N>>D>>T; map > group; FOR(i,N){ int X; cin>>X; group[X % D].push_back((X + 1000000000) / D); } long long ans = 0 ; for(auto p : group){ VI v(p.second); sort(ALL(v)); long long range = v[SZ(v)-1] - v[0] + 2LL * T + 1; FOR(i,SZ(v) - 1) { range -= max(v[i + 1] - v[i] - 1 - 2LL * T, 0LL); } ans += range; } cout<