#include <bits/stdc++.h>
using namespace std;
class Cord {
 public:
  int c;
  int t;
  int isstart;
};
bool compare(Cord a, Cord b) {
  if (a.c == b.c) {
    return a.t > b.t;
  }
  return (a.c < b.c);
}
int main() {
  int n, d;
  cin >> n >> d;
  int input;
  vector<int> dat;
  Cord buf;
  for (int i = 0; i < n; i++) {
    cin >> input;
    dat.push_back(input);
  }
  sort(dat.begin(), dat.end());
  int ans = 2;
  int prev = dat.front();
  int dis;
  for (auto it = dat.begin()++; it != dat.end(); it++) {
    dis = *it - prev;
    if (dis > 2 * d)
      ans += 2;
    else if (dis == 2 * d)
      ans += 1;
    else
      ;
    prev = *it;
  }
  cout << ans;
  return 0;
}
