#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } //constexpr long long MAX = 5100000; constexpr long long INF = 1LL << 60; constexpr int inf = 1000000007; //constexpr long long mod = 1000000007LL; //constexpr long long mod = 998244353LL; const long double PI = acos((long double)(-1)); using namespace std; typedef unsigned long long ull; typedef long long ll; typedef long double ld; int main() { /* cin.tie(nullptr); ios::sync_with_stdio(false); */ int n, D, T; scanf("%d %d %d", &n, &D, &T); vector x(n); for (int i = 0; i < n; i++) scanf("%d", &x[i]); map> mp; for (int i = 0; i < n; i++) mp[x[i] % D].emplace_back(x[i]); ll res = 0; for (auto& p : mp) { auto& v = p.second; sort(v.begin(), v.end()); for (int i = 0; i + 1 < v.size(); i++) { int t = (v[i + 1] - v[i]) / D; if (t <= T * 2) res += t; else res += T * 2 + 1; } res += T + T + 1; } cout << res << endl; return 0; }