#include <bits/stdc++.h>
using namespace std;
int fab(int a) {
  if (a < 0) return -a;
  return a;
}
int main() {
  int t, n, i, d, w = 0, j, *a, te, dis;
  int b[500];
  cin >> n >> d;
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  t = n;
  for (i = 0; i < n; i++) {
    te = b[i] + d;
    a = find(b, b + t, te);
    if (a == b + t) {
      dis = d;
      for (j = 0; j < n; j++) {
        dis = min(fab(b[j] - te), dis);
      }
      if (dis == d) {
        w++;
        b[t++] = te;
      }
    }
  }
  for (i = 0; i < n; i++) {
    te = b[i] - d;
    a = find(b, b + t, te);
    if (a == b + t) {
      dis = d;
      for (j = 0; j < n; j++) {
        dis = min(fab(b[j] - te), dis);
      }
      if (dis == d) {
        w++;
        b[t++] = te;
      }
    }
  }
  cout << w;
  return 0;
}
