#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define LL long long LL l[100]; LL r[100]; LL type[100]; LL D, T, X; vector < list > adj(100); LL bfs(int v){ if (type[v] < 0)return 0; LL right = r[v]; LL left = l[v]; type[v] = -1; queue que; que.push(v); while (que.empty() == false){ v = que.front(); que.pop(); right = max(right, r[v]); left = min(left, l[v]); for (auto& u : adj[v]){ if (type[u] < 0)continue; que.push(u); type[u] = -1; } } return (right - left) / D + 1; } int main(void){ int N; cin >> N >> D >> T; for (int i = 0; i < N; i++){ cin >> X; l[i] = X - D*T; r[i] = X + D*T; type[i] = r[i] % D; } for (int i = 0; i < N; i++) for (int j = i + 1; j < N; j++) if (type[i] == type[j] && (-min(l[i], l[j]) + max(r[i], r[j]) <= r[i] - l[i] + r[j] - l[j])){ adj[i].push_back(j); adj[j].push_back(i); } LL res = 0; for (int i = 0; i < N; i++){ res += bfs(i); } cout << res << endl; return 0; }