#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d;
  cin >> n >> d;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  double a = 2 * d;
  sort(arr, arr + n);
  int count = 0;
  for (int i = 0; i < n - 1; i++) {
    double k;
    k = arr[i] - arr[i + 1];
    k = abs(k);
    double z = k / d;
    if (k > a) {
      count = count + 2;
    } else if (k == a) {
      count = count + 1;
    }
  }
  cout << count + 2 << endl;
}
