#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d;
  cin >> n >> d;
  int a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  set<int> poss;
  for (int i = 0; i < n; ++i) {
    poss.insert(a[i] + d);
    poss.insert(a[i] - d);
  }
  int ans = 0;
  for (auto i : poss) {
    bool ok = 1;
    for (int j = 0; j < n; ++j) {
      if (abs(a[j] - i) < d) ok = 0;
    }
    if (ok) ++ans;
  }
  cout << ans << endl;
  return 0;
}
