#include "bits/stdc++.h" using namespace std; typedef long long Int; #define REP(i,n) for(int (i)=0;(i)<(int)(n);++(i)) Int solve(vector v, Int D, Int T) { vector> rs; for (auto x : v) { x /= D; rs.emplace_back(make_pair(x - T, +1)); rs.emplace_back(make_pair(x + T, -1)); } auto comp = [](pair a, pair b) { return a.first != b.first ? a.first < b.first : a.second > b.second; }; sort(rs.begin(), rs.end(), comp); Int res = 0; int open_count = 0; Int open_pos = -1; for (auto r : rs) { open_count += r.second; if (open_count == 0) { Int close_pos = r.first; res += close_pos - open_pos + 1; } if (open_count == 1 && r.second == 1) { open_pos = r.first; } } return res; } int main() { int N, D, T; cin >> N >> D >> T; Int x[100]; REP(i, N) { cin >> x[i]; x[i] += 1000000000; } map > mp; REP(i, N){ mp[x[i] % D].push_back(x[i]); } Int ans = 0; for (auto it = mp.begin(); it != mp.end(); ++it) { ans += solve(it->second, D, T); } cout << ans << endl; }