#include <bits/stdc++.h>
using namespace std;
int n, d;
int r = -2e9 - 1, cnt;
int main() {
  scanf("%d%d", &n, &d);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    if (x - d > r)
      cnt += 2;
    else if (x - d == r)
      cnt++;
    r = x + d;
  }
  printf("%d\n", cnt);
  return 0;
}
