#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long int> hotels;
  long long int n, d, ele, count = 2, diff, a, b;
  cin >> n >> d;
  for (long long int i = 0; i < n; i++) {
    cin >> ele;
    hotels.push_back(ele);
  }
  sort(hotels.begin(), hotels.end());
  for (long long int i = 0; i < n - 1; i++) {
    a = hotels[i] + d;
    b = hotels[i + 1] - d;
    if (b < a) {
      continue;
    }
    if (a == b) {
      count += 1;
    }
    if (b > a) {
      count += 2;
    }
  }
  cout << count << endl;
  return 0;
}
