#include <bits/stdc++.h>
using namespace std;
int tree[2000004];
int A[500002];
long long modular_pow(long long base, long long exponent, long long modulus) {
  long long result = 1;
  while (exponent > 0) {
    if (exponent % 2 == 1) result = (result * base) % modulus;
    exponent = exponent >> 1;
    base = (base * base) % modulus;
  }
  return result;
}
void build(int node, int start, int end) {
  if (start == end) {
    tree[node] = A[start];
  } else {
    int mid = (start + end) / 2;
    build(2 * node, start, mid);
    build(2 * node + 1, mid + 1, end);
    tree[node] = tree[2 * node] + tree[2 * node + 1];
  }
}
int query(int node, int start, int end, int l, int r) {
  if (r < start or end < l) {
    return 0;
  }
  if (l <= start and end <= r) {
    return tree[node];
  }
  int mid = (start + end) / 2;
  int p1 = query(2 * node, start, mid, l, r);
  int p2 = query(2 * node + 1, mid + 1, end, l, r);
  return (p1 + p2);
}
int main() {
  int n, d;
  scanf("%d %d", &n, &d);
  int ar[n];
  for (int i = 0; i < n; i++) scanf("%d", &ar[i]);
  sort(ar, ar + n);
  long long int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (ar[i + 1] - ar[i] > 2 * d) {
      ans += 2;
      continue;
    }
    if (ar[i + 1] - ar[i] == 2 * d) {
      ans++;
      continue;
    }
  }
  ans += 2;
  cout << ans << '\n';
  return 0;
}
