#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  vector<long long int> a(t);
  vector<int> v;
  int x;
  cin >> x;
  for (int i = 0; i < t; i++) cin >> a[i];
  sort(a.begin(), a.end());
  v.push_back(a[0] - x);
  for (int i = 0; i < t; i++) {
    if (a[i] - x >= a[i - 1] + x && i != 0) v.push_back(a[i] - x);
    if (a[i] + x <= a[i + 1] - x) v.push_back(a[i] + x);
  }
  sort(v.begin(), v.end());
  int uniqueCount = std::unique(v.begin(), v.end()) - v.begin();
  cout << uniqueCount << endl;
  return 0;
}
