#include <bits/stdc++.h>
using namespace std;
int arr[200][4];
map<int, int> mp;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, d;
  cin >> n >> d;
  set<int> st;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    arr[i][0] = x;
    arr[i][1] = x - d + 1;
    arr[i][2] = x + d - 1;
  }
  int cntr = 0;
  for (int i = 0; i < n; i++) {
    int l = arr[i][0] - d, r = arr[i][0] + d, c1 = 1, c2 = 1;
    for (int j = 0; j < n; ++j) {
      if (i == j) continue;
      if (l >= arr[j][1] && l <= arr[j][2]) c1 = 0;
      if (r >= arr[j][1] && r <= arr[j][2]) c2 = 0;
    }
    if (c1 && !mp[l]) {
      cntr++;
      mp[l] = 1;
    }
    if (c2 && !mp[r]) {
      cntr++;
      mp[r] = 1;
    }
  }
  cout << cntr;
  return 0;
}
