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