#include <bits/stdc++.h>
using namespace std;

int n, m, t, ans = 0, a, bf;

int main() {
  int i;
  cin >> n >> m >> t;
  for(i = 0; i < n; ++i) {
    cin >> a;
    if(i == 0)
      ans += a - m;
    else if((a - bf) > 2 * m)
      ans += (a - bf) - 2 * m;
    if(i == n - 1 && (t - a) > m) ans += (t - a) - m;
    bf = a;
  }
  cout << ans << endl;
}
