#include <bits/stdc++.h>
const long long sze = 2e5 + 50, psze = 30, INF = 1e18;
const double eps = 1e-9;
using namespace std;
vector<long long> vertices[sze];
vector<char> visit(sze);
vector<long long> dp(sze);
vector<long long> arr(sze, 0);
bool did_dp[100];
bool checker[sze];
long long n;
long long m;
long long k;
long long cnt = 0;
char tbl[100][100];
long long cnts[sze];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long d;
  cin >> n >> d;
  cnt = 2;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (long long i = 0; i < n - 1; i++) {
    k = arr[i] + d;
    if (arr[i + 1] - k > d) {
      cnt += 2;
    }
    if (arr[i + 1] - k == d) {
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}
