#include #include #include #include using namespace std; #define RREP(i,s,e) for (i = s; i >= e; i--) #define rrep(i,n) RREP(i,n,0) #define REP(i,s,e) for (i = s; i < e; i++) #define rep(i,n) REP(i,0,n) #define INF 100000000 typedef long long ll; int main() { int i, j, n, d; ll t,ans; map> m; cin >> n >> d >> t; ans = 0; rep (i,n) { int x; cin >> x; int y = (x%d+d)%d; m[y].push_back((x-y)/d); } for (auto p : m) { auto v = p.second; sort(v.begin(),v.end()); ll left = -2e9-1; for (ll x : v) { ans += min(2*t + 1,x + t - left); left = x + t; } } cout << ans << endl; return 0; }