#include using namespace std; #define int long long typedef long long ll; typedef pairpint; typedef vectorvint; typedef vectorvpint; #define pb push_back #define mp make_pair #define fi first #define se second #define ln <void chmin(T &t,U f){if(t>f)t=f;} templatevoid chmax(T &t,U f){if(t>N>>D>>T; rep(i,N)cin>>X[i]; mapM; rep(i,N)M[(X[i]+D*1000000000)%D].pb(X[i]); int ans=0; for(auto it:M){ vint &v=it.se; sort(all(v)); rep(i,v.size()){ v[i]-=it.fi; v[i]/=D; l[i]=v[i]-T; r[i]=v[i]+T; } int pre=-1145141919810ll; rep(i,v.size()){ chmax(pre,l[i]); ans+=r[i]-pre+1; pre=r[i]+1; } } cout<