#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main() {
  int n, d;
  cin >> n >> d;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  if (n == 1) {
    cout << 2;
    return 0;
  }
  int cnt = 2;
  int cnt2 = 0;
  sort(v.begin(), v.end());
  for (int i = 1; i < n - 1; i++) {
    if (abs(v[i] - v[i - 1]) > 2 * d) {
      cnt++;
    }
    if (abs(v[i + 1] - v[i]) > 2 * d) {
      cnt++;
    }
    if (abs(v[i] - v[i - 1]) == 2 * d) {
      cnt2++;
    }
    if (abs(v[i + 1] - v[i]) == 2 * d) {
      cnt2++;
    }
  }
  int i = n - 1;
  if (abs(v[i] - v[i - 1]) > 2 * d) {
    cnt++;
  }
  if (abs(v[i] - v[i - 1]) == 2 * d) {
    cnt2++;
  }
  i = 0;
  if (abs(v[i + 1] - v[i]) > 2 * d) {
    cnt++;
  }
  if (abs(v[i + 1] - v[i]) == 2 * d) {
    cnt2++;
  }
  cnt2 /= 2;
  cout << cnt + cnt2;
  return 0;
}
