#include #include #include #include using namespace std; typedef long long ll; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) map> m; int main(){ int N,D,T,X; cin >> N >> D >> T; REP(i,N){ cin >> X; int k = (X+1000000000) % D; m[k].push_back((X+1000000000)/D); } ll res = 0; for(auto it = m.begin(); it != m.end(); ++it){ auto v = it->second; sort(v.begin(), v.end()); ll minv = -(1LL<<62); for(auto jt = v.begin(); jt != v.end(); ++jt){ ll l = *jt - T, r = *jt + T; if(minv > l) l = minv+1; res += r-l+1; minv = r; } } cout << res << endl; return 0; }