#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const long long mod = 1e9 + 7;
long long ksm(long long a, long long b) {
  long long res = 1LL;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
int a[N];
void solve() {
  int n, d;
  scanf("%d %d", &n, &d);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + n + 1);
  int ans = 2;
  for (int i = 2; i <= n; i++) {
    if (a[i] - a[i - 1] - 2 * d > 0) {
      ans += 2;
    } else if (a[i] - a[i - 1] - 2 * d == 0) {
      ans++;
    }
  }
  printf("%d\n", ans);
}
int main() {
  solve();
  return 0;
}
