#include using namespace std; using i64 = int64_t; using vi = vector; using vvi = vector; int main() { unordered_map as; i64 n, d, t; cin >> n >> d >> t; for (int i = 0; i < n; i++) { i64 x; cin >> x; as[((x % d) + d) % d].push_back(x); } for (auto& a: as) { sort(a.second.begin(), a.second.end()); } i64 ans = 0; for (auto& a: as) { if (a.second.size() == 1) { ans += 2 * t + 1; continue; } i64 nax = a.second.front() + t * d; ans += 2 * t + 1; for (int i = 1; i < a.second.size(); i++) { i64 k = a.second[i] - t * d; if (k > nax) { ans += 2 * t + 1; } else { ans += 2 * t - (nax - k) / d; } nax = a.second[i] + t * d; } } cout << ans << endl; }