#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using vi = vector; using vvi = vector; using vl = vector; using vvl = vector; using vb = vector; using vvb = vector; using vd = vector; using vs = vector; using pii = pair; using pll = pair; using pdd = pair; using vpii = vector; using vpll = vector; using vpdd = vector; const int inf = (1 << 30) - 1; const ll INF = 1LL << 60; //const int MOD = 1000000007; const int MOD = 998244353; int main() { ll n, d, t; cin >> n >> d >> t; vi x(n); map mp; for (int i = 0; i < n; i++) { cin >> x[i]; int m = x[i] % d; if (m < 0) m += d; mp[m].push_back(x[i]); } ll ans = 0; for (auto& [k, v] : mp) { int sz = v.size(); sort(v.begin(), v.end()); ans += sz; ans += t * 2; for (int i = 0; i < sz - 1; i++) { int diff = v[i + 1] - v[i]; ll tm = (diff + d * 2 - 1) / (d * 2) - 1; ans += min(tm, t) * 2; if (tm < t && (diff / d) % 2 == 0) ans++; } } cout << ans << endl; return 0; }