#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long int n, d;
  cin >> n >> d;
  long long int arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  long long int c = 0, val;
  for (long long i = 0; i < n; i++) {
    val = arr[i] - d;
    if (i == 0 || val >= arr[i - 1] + d) c++;
    val = arr[i] + d;
    if (i == n - 1 || val < arr[i + 1] - d) c++;
  }
  cout << c << "\n";
}
