#include <bits/stdc++.h>
using namespace std;
long long a[1010];
map<long long, bool> mp;
int main() {
  long long n, d, ans = 0, fx, fy, x, y;
  cin >> n >> d;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (long long i = 1; i <= n; i++) {
    x = (a[i] - d);
    y = (a[i] + d);
    fx = 0;
    fy = 0;
    for (int j = 1; j <= n; j++) {
      if (abs(a[j] - x) < d) fx = 1;
      if (abs(a[j] - y) < d) fy = 1;
    }
    if (!fx && !mp[x]) {
      ans++;
      mp[x] = 1;
    }
    if (!fy && !mp[y]) {
      ans++;
      mp[y] = 1;
    }
  }
  cout << ans << endl;
}
