#include #include #include #include using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; ll d, t; map> x_mod_d; cin >> n >> d >> t; for (int i = 0; i < n; i++) { ll x; cin >> x; if (x >= 0) x_mod_d[x % d].push_back(x); else { auto idx = d - (abs(x) % d); x_mod_d[idx].push_back(x); } } ll ans = 0; for (auto it = x_mod_d.begin(); it != x_mod_d.end(); it++) { auto& vec = it->second; sort(vec.begin(), vec.end()); for (auto x_i = 0; x_i < vec.size(); x_i++) { if (x_i == 0) ans += 2 * t + 1; else { ans += min(2 * t + 1, (vec[x_i] - vec[x_i - 1]) / d); } } } cout << ans << endl; return 0; }