#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e9 + 10;
const int MAX = 1e3 + 10;
const int MOD = 1e9 + 7;
const double eps = 1e-6;
int n, d;
int s[MAX];
int main() {
  cin >> n >> d;
  for (int i = 0; i < n; i++) scanf("%d", &s[i]);
  sort(s, s + n);
  int cnt = 2;
  for (int i = 1; i < n; i++) {
    if ((s[i] - s[i - 1]) > d * 2)
      cnt += 2;
    else if ((s[i] - s[i - 1]) == d * 2)
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}
