using namespace std;
#include <iostream>
#include <fstream>
#include <queue>
int N,M,L;
int main() {
cin >> N >> M >> L;
int curLimit = 0;
queue<int> q;
int ans = 0;
// cout << "done" << endl;
for(int i = 0;i < N;++i) {
int cur;
cin >> cur;
int last = -1;
while(q.size() > 0 && q.front() < cur) {
curLimit--;
last = q.front();
q.pop();
}
if(last != - 1 && curLimit == 0) {
ans += cur - last - 1;
}
if(curLimit == L) {
q.push(q.front() + M);
q.pop();
}
if(curLimit < L) {
q.push(cur + M - 1);
curLimit++;
}
}
cout << ans << endl;
}
dXNpbmcgbmFtZXNwYWNlIHN0ZDsKCiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPGZzdHJlYW0+CiNpbmNsdWRlIDxxdWV1ZT4KCmludCBOLE0sTDsKCmludCBtYWluKCkgewoJY2luID4+IE4gPj4gTSA+PiBMOwoKCWludCBjdXJMaW1pdCA9IDA7CglxdWV1ZTxpbnQ+IHE7CglpbnQgYW5zID0gMDsKCS8vIGNvdXQgPDwgImRvbmUiIDw8IGVuZGw7Cglmb3IoaW50IGkgPSAwO2kgPCBOOysraSkgewoJCWludCBjdXI7CgkJY2luID4+IGN1cjsKCQlpbnQgbGFzdCA9IC0xOwoJCXdoaWxlKHEuc2l6ZSgpID4gMCAmJiBxLmZyb250KCkgPCBjdXIpIHsKCQkJY3VyTGltaXQtLTsKCQkJbGFzdCA9IHEuZnJvbnQoKTsKCQkJcS5wb3AoKTsKCQl9CgkJaWYobGFzdCAhPSAtIDEgJiYgY3VyTGltaXQgPT0gMCkgewoJCQlhbnMgKz0gY3VyIC0gbGFzdCAtIDE7CgkJfQoJCWlmKGN1ckxpbWl0ID09IEwpIHsKCQkJcS5wdXNoKHEuZnJvbnQoKSArIE0pOwoJCQlxLnBvcCgpOwoJCX0KCQlpZihjdXJMaW1pdCA8IEwpIHsKCQkJcS5wdXNoKGN1ciArIE0gLSAxKTsKCQkJY3VyTGltaXQrKzsKCQl9Cgl9Cgljb3V0IDw8IGFucyA8PCBlbmRsOwp9