#include #include #include #include using lint = long long; constexpr lint INF = 1000000000; void solve() { int n; lint d, t; std::cin >> n >> d >> t; std::map> xss; while (n--) { int x; std::cin >> x; x += INF; xss[x % d].push_back(x / d); } lint ans = 0; for (auto& [r, xs] : xss) { std::sort(xs.begin(), xs.end()); lint pr = -INF; for (auto x : xs) { lint l = std::max(x - t, pr + 1), r = x + t; ans += r - l + 1; pr = r; } } std::cout << ans << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }