import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class CodeChef2 {

	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));

        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

//
//	static class Line{
//		Point p1;
//		Point p2;
//
//		Line(Point p1,Point p2){
//			this.p1=p1;
//			this.p2=p2;
//		}
//
//	    static Boolean intersects(Line l1,Line l2)
//	    {
//	    	Point A=l1.p1, B=l1.p2,C=l2.p1,D=l2.p2;
//
//	        long a1 = B.y - A.y;
//	        long b1 = A.x - B.x;
//	        long c1 = a1*(A.x) + b1*(A.y);
//
//	        long a2 = D.y - C.y;
//	        long b2 = C.x - D.x;
//	        long c2 = a2*(C.x)+ b2*(C.y);
//
//	        long determinant = a1*b2 - a2*b1;
//
//	        if (determinant == 0)
//	        {
//	            return false;
//	        }
//	        else
//	        {
//	            long x = (b2*c1 - b1*c2)/determinant;
//	            long y = (a1*c2 - a2*c1)/determinant;
//
//	            if(x>=0 || x<=1) {
//	            	return true;
//	            }
//	            return false;
//	        }
//	    }
//
//	    static Point getSlope(Line l) {
//	    	long num=l.p1.y - l.p2.y;
//	    	long den=l.p1.x - l.p2.x;
//
//	    	long gcd=gcd(num,den);
//	    	return new Point(num/gcd,den/gcd);
//	    }
//
//		private static long gcd(long a, long b) {
//			return b==0?a:gcd(b,a%b);
//		}
//
//	}

	static class Pair{
		int x;
		long y;

		Pair(int x,long y, Integer integer, int i){
			this.y=y;
			this.x=x;
		}

		@Override
		public String toString() {
			return "(" + x +" "+ y+")";
		}

	}

	static class Edge{
		int src;
		int dest;
		int cost;
		int val;

		Edge(int src,int dest,int cost,int val){
			this.src=src;
			this.dest=dest;
			this.cost=cost;
			this.val=val;
		}

		public String toString() {
			return "(" + src +" "+ dest+": "+ cost +" , "+val+")";
		}

	}

    static class Pair2{
    	Pair node;
    	int dist;

    	Pair2(Pair p,int dist){
    		node=p;
    		this.dist=dist;
    	}
    }

    static long M=1000000007l;
    static HashMap<Character,ArrayList<Character>> dirs;

    public static void main(String[] args) throws Exception {
        FastReader sc=new FastReader();
        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));

//        ArrayList<Integer> prime=getPrimeSieve();
        int t=sc.nextInt();
        int po=0;

        dirs=new HashMap<>();
        dirs.put('U', new ArrayList<>());
        dirs.get('U').addAll(Arrays.asList('U','R','D','L'));
        dirs.put('L', new ArrayList<>());
        dirs.get('L').addAll(Arrays.asList('L','U','R','D'));
        dirs.put('D', new ArrayList<>());
        dirs.get('D').addAll(Arrays.asList('D','L','U','R'));
        dirs.put('R', new ArrayList<>());
        dirs.get('R').addAll(Arrays.asList('R','D','L','U'));
//
        outer:while(t-- >0) {
        	po++;
        	int n=sc.nextInt();
        	int x=(int) Math.sqrt(n/2);
        	int y=(int) Math.sqrt(n/4);

        	if(x*x*2 == n || y*y*4==n)
        		bw.append("YES\n");
        	else {
        		bw.append("NO\n");
        	}
//        	int x=sc.nextInt();
//        	Integer[] arr=new Integer[n];
//        	long sum=0;
//
//        	for(int i=0;i<n;i++) {
//        		arr[i]=sc.nextInt();
//        		sum+=arr[i];
//        	}
//
//        	if(sum==x) {
//    			bw.append("NO\n");
//    			continue outer;
//        	}
//
//        	Arrays.sort(arr,Collections.reverseOrder());
//
//        	sum=0;
//        	for(int i=0;i<n-1;i++) {
//        		sum+=arr[i];
//
//        		if(sum==x) {
//        			int temp=arr[i];
//        			arr[i+1]=arr[i];
//        			arr[i]=temp;
//            		sum=sum-arr[i+1]+arr[i];
//        		}
//        	}
//        	bw.append("YES\n");

//        	for(int i=0;i<n;i++) {
//        		bw.append(arr[i]+" ");
//        	}
//        	bw.append("\n");
//        	bw.append("Case #"+po+": "+0+"\n");
        }
        bw.close();
    }

	private static int abs(int i) {
		if(i<0) {
			return -i;
		}
		return i;
	}

	private static String getRoaring2(String s) {
		String res="";
		String max="";

		for(int i=1;i<=s.length()/2;i++) {

			long prev=Long.parseLong(s.substring(0, i));
			res=Long.toString(prev);
			long prev1=Long.parseLong(res);
			long ans=Long.parseLong(s);
			long next=prev+1;

			while(prev1 <= ans) {
				prev1=Long.parseLong(res+Long.toString(next));
				res+=Long.toString(next);
				next++;
			}
			if(max.length() == 0) {
				max=res;
				res="";
			}else {
				Long a=Long.parseLong(max);
				long m=Math.max(a, prev1);
				max=Long.toString(m);
			}
		}
		return max;
	}

	private static String getRoaring(String s) {
		int val=-1;
		for(int i=1;i<=s.length()/2;i++) {
			long prev=Long.parseLong(s.substring(0, i));
			int j=i,update=i;

			while(j<s.length()) {
				if(numDigit(prev+1) > numDigit(prev)) {
					update++;
				}
				if(j+update > s.length()) {
					break;
				}
				long cur=Long.parseLong(s.substring(j, j+update));
				if(cur != prev+1) {
					break;
				}
				prev=cur;
				j+=update;
			}

			if(j>= s.length()) {
				val=i;
				break;
			}
		}

		if(val==-1) {
			return "";
		}else {
			String res="";
			long prev=Long.parseLong(s.substring(0, val));
			res=Long.toString(prev+1);
			System.out.println(res+ " ");

			long prev1=Long.parseLong(res);

			long ans=Long.parseLong(s);

			long next=prev+1;

			while(prev1 <= ans) {
				prev1=Long.parseLong(res+Long.toString(next));
				next++;
			}
			return Long.toString(prev1);
		}

	}

	private static boolean isRoaring(String s) {
		for(int i=1;i<=s.length()/2;i++) {
			long prev=Long.parseLong(s.substring(0, i));
//			System.out.println("prev= "+prev+" ");
			int j=i,update=i;

			while(j<s.length()) {
				if(numDigit(prev+1) > numDigit(prev)) {
					update++;
				}
				if(j+update > s.length()) {
					break;
				}
				long cur=Long.parseLong(s.substring(j, j+update));
//				System.out.println("cur= "+cur+" ");
				if(cur != prev+1) {
					break;
				}
				prev=cur;
				j+=update;
			}

			if(j>= s.length()) {
				return true;
			}
		}
		return false;
	}

	private static long numDigit(long ans) {
		long sum=0;
		while(ans > 0) {
			sum++;
			ans/=10;
		}
		return sum;
	}

	private static boolean go(int i, int j, long n, long m, Integer k, HashMap<Integer, Boolean>[][] dp) {
		if(i==n && j==m && k==0) {
			return true;
		}
		if(i<1 || j<1 || i>n || j>m || k<0) {
			return false;
		}
		if(dp[i][j].containsKey(k)) {
			return dp[i][j].get(k);
		}

		boolean down=go(i+1,j,n,m,k-j,dp);
		boolean left=go(i,j+1,n,m,k-i,dp);

		dp[i][j].put(k, left||down);
		return left||down;
	}

	private static long getDigitSum(long ans) {
		long sum=0;
		while(ans > 0) {
			sum+=ans%10;
			ans/=10;
		}
		return sum;
	}

	private static boolean getAns2(int l, long[] prefix, long x) {

		for(int i=l;i<prefix.length-1;i++) {
			if((x^prefix[i]) == (prefix[prefix.length-1]^prefix[i])) {
				return true;
			}
		}
		return false;
	}

	private static boolean getAns(long[] prefix) {

		for(int i=0;i<prefix.length-1;i++) {
			if(prefix[i] == (prefix[prefix.length - 1]^prefix[i])) {
				return true;
			}
		}

		return false;
	}

	private static void rotate(ArrayList<Integer> arr, int i) {
		reverse(arr,0,i-1);
		reverse(arr,i,arr.size()-1);
		reverse(arr,0,arr.size()-1);
	}

	private static void reverse(ArrayList<Integer> arr, int l, int m) {
		while(l<m) {
			int temp=arr.get(l);
			arr.set(l,arr.get(m));
			arr.set(m, temp);
			l++;
			m--;
		}
	}

	static int modInverse(int a, int m)
    {
        int m0 = m;
        int y = 0, x = 1;

        if (m == 1)
            return 0;

        while (a > 1) {
            int q = a / m;

            int t = m;

            m = a % m;
            a = t;
            t = y;

            y = x - q * y;
            x = t;
        }

        if (x < 0)
            x += m0;

        return x;
    }

	private static long isPerfectSquare(long num) {
		long l=1,h=num;

		while(l<=h) {
			long mid=l+(h-l)/2;

			if(mid*mid == num) {
				return mid;
			}else if(mid*mid < num) {
				l=mid+1;
			}else {
				h=mid-1;
			}
		}
		return -1;
	}

	private static void rightmax(long[] arr, long n,int[] res,int[] rightmax) {

		Deque<Integer> stack=new ArrayDeque<>();

		stack.clear();
		for(int i=(int) (n-1);i>=0;i--) {
			while(!stack.isEmpty() && arr[stack.peek()] <= arr[i]) {
				stack.pop();
			}

			rightmax[i]=(stack.isEmpty()?Integer.MAX_VALUE:stack.peek());
			stack.addFirst(i);
		}
	}

	private static boolean rotatedSorted(long[] arr, int min) {
		reverse(arr,0,min-1);
		reverse(arr,min,arr.length-1);
		reverse(arr,0,arr.length-1);

		if(isSorted(arr)) {
			return true;
		}
		return false;
	}

	private static boolean isSorted(long[] arr) {
		for(int i=1;i<arr.length;i++) {
			if(arr[i] < arr[i-1]) {
				return false;
			}
		}
		return true;
	}

	private static int countDigit(long x) {
		int count=0;
		while(x > 0) {
			x/=10;
			count++;
		}
		return count;
	}

	private static boolean isSub(String s, String c) {
		int l=0;

		for(int i=0;i<s.length();i++) {
			if(l < c.length() && c.charAt(l)==s.charAt(i)) {
				l++;
			}
			if(l==c.length()) {
				break;
			}
		}
		if(l==c.length()) {
			return true;
		}
		return false;
	}

	static long power(long a, long d, long n)
	 {
		    long res = 1;
		    a = a % n;
		    if (a == 0)
		      return 0;

		    while (d > 0)
		    {

		      if ((d & 1) != 0)
		        res = (res * a) % n;

		      d = d >> 1;
		      a = (a * a) % n;
		    }
		    return res;
		  }

	private static void reverse(long[] arr,int l,int m) {
		while(l<m) {
			long temp=arr[l];
			arr[l]=arr[m];
			arr[m]=temp;
			l++;
			m--;
		}
	}

	 static int UpperBound(ArrayList<Integer> a, int x) {// x is the key or target value
		    int l=-1,r=a.size();
		    while(l+1<r) {
		       int m=(l+r)>>>1;
		       if(a.get(m)<=x) l=m;
		       else r=m;
		    }
		    return l+1;
	 }

	private static void printMat(int[][] dp) {

    	System.out.println("--------------------------------------------------------------------");
		for(int i=0;i<dp.length;i++) {
    		for(int j=0;j<dp[0].length;j++) {
    			System.out.print(dp[i][j]+" ");
    		}
    		System.out.println();
    	}
		System.out.println("--------------------------------------------------------------------");
	}

	private static int highestOneBit(long n) {
		long x=Long.highestOneBit(n);
		int c=0;
		while(x >0) {
			x=x/2;
			c++;
		}
		return c-1;
	}

	private static int bitcount(long l) {
		int count=0;

    	while(l>0) {
			l-=(l&(-l));
			count++;
		}
		return count;
	}

	private static void bfs(HashMap<Integer, HashSet<Integer>> tree, int start) {
    	Queue<Integer> q=new LinkedList<>();
		q.offer(start);
		HashSet<Integer> visited=new HashSet<>();

		System.out.print(q.peek()+"\n");

		while(!q.isEmpty()) {
			int parent=q.poll();

			if(visited.contains(parent)) {
				continue;
			}
			visited.add(parent);
			int flag=0;

			for(int child:tree.get(parent)) {
				if(!visited.contains(child)) {
					q.offer(child);
					System.out.print(child+" ");
					flag=1;
				}
			}

			if(flag==0) {
				continue;
			}
			System.out.println();
		}
	}

	static int par;
	private static HashMap<Integer, HashSet<Integer>> getTreeInputLevel(StringTokenizer st) {
		Queue<Integer> q=new LinkedList<>();

		HashMap<Integer, HashSet<Integer>> tree=new HashMap<>();
		q.offer(Integer.parseInt(st.nextToken()));

		par=q.peek();

		while(!q.isEmpty()) {
			int parent=q.poll();

			if(!tree.containsKey(parent)) {
				tree.put(parent, new HashSet<Integer>());
			}

			int left=-1,right=-1;

			if(st.hasMoreElements())
				left=Integer.parseInt(st.nextToken());

			if(st.hasMoreElements())
				right=Integer.parseInt(st.nextToken());

			if(left != -1) {
				tree.get(parent).add(left);
				if(!tree.containsKey(left)) {
					tree.put(left, new HashSet<Integer>());
				}
				tree.get(left).add(parent);
				q.offer(left);
			}

			if(right != -1) {
				tree.get(parent).add(right);
				if(!tree.containsKey(right)) {
					tree.put(right, new HashSet<Integer>());
				}
				tree.get(right).add(parent);
				q.offer(right);
			}

		}
		tree.remove(-1);
		return tree;
	}

	private static int containsString(String s1,String s2) {
		String s=s1+"#"+s2;
		int[] z=getZfunc(s);

		boolean flag=false;
		for(int i=0;i<s.length();i++) {
			if(z[i]==s1.length()) {
				flag=true;
			}
		}
		int count=0;

		for(int i=s1.length();i<z.length;i++) {
//			System.out.print(z[i]+" ");
			if(z[i]==s1.length()) {
				count++;
			}
		}
//		System.out.println();
		return count;
	}

	private static int[] getZfunc(String s) {
		int[] z=new int[s.length()];
		 int l=0,r=0;

		 for(int i=1;i<s.length();i++) {

			 if(i <= r) {
				 z[i]=Math.min( z[i-l] , r-i+1);
			 }
			 while(i+z[i] < s.length() && s.charAt(z[i])==s.charAt(i+z[i])) {
				 z[i]++;
			 }
			 if(i+z[i] -1 > r) {
				 l=i;
				 r=i+z[i]-1;
			 }

		 }
		return z;
	}

	private static long ceil(long n,long k) {
		long ans;
		if(n%k==0) {
			ans=n/k;
		}else {
			ans=n/k+1;
		}
		return ans;
	}

	static ArrayList<Integer> getDivisor(int n){
    	ArrayList<Integer> div=new ArrayList<>();

        for (int i=1; i*i <= n; i++)
        {
            if (n%i==0)
            {
                if (n/i == i)
                    div.add(i);
                else {
                    div.add(i);
                    div.add(n/i);
                }
            }
        }

        return div;
    }

    static long gcd(long x,long y) {
    	return (y==0?x:gcd(y,x%y));
    }

	static int MAXN = 1000001;
	static int[] spf=new int[MAXN];

    static void sieveSmallestFactor()
    {
        spf[1] = 1;

        for (int i=2; i<MAXN; i++)
        	spf[i] = i;

        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;

        for (int i=3; i*i<MAXN; i++)
        {
            if (spf[i] == i)
            {
                for (int j=i*i; j<MAXN; j+=i)
                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }

	private static HashMap<Integer,Integer> PrimeFactorizationmap(long n) {
		int count=0;

		HashMap<Integer,Integer> factors=new HashMap<>();
		if(n==1) {
			factors.put( 1,1);
			return factors;
		}else {
			for(long i=2; i*i <= n ;i++) {
				long z=n;
				if(z%i==0) {
					count=0;
					while(z%i==0) {
						count++;
						z=z/i;
					}
					factors.put((int) (i+0),count);
				}
			}
			if(n>1) {
				factors.put((int) (n+0),1);
			}
		}
		return factors;
	}

    static HashMap<Integer,Integer> getprimeFactors(int n)
    {
        HashMap<Integer,Integer> ret = new HashMap<>();
        while (n > 1)
        {
        	if(ret.containsKey(spf[n])) {
        		ret.put(spf[n],ret.get(spf[n])+1);
        	}else {
        		ret.put(spf[(int) n],1);
        	}
            n = n / spf[n];
        }

        return ret;
    }

    static ArrayList<Integer> getPrimeSieve(){
		int primesieve[]=new int[1000005];

		Arrays.fill(primesieve,0);

		for(int i=2;i*i<primesieve.length;i++) {
			if(primesieve[i]==0)
				for(int j=i*i;j<primesieve.length;j+=i) {
						primesieve[j]=1;
				}
		}

		ArrayList<Integer> prime=new ArrayList<>();
		for(int i=2;i<primesieve.length;i++) {
			if(primesieve[i]==0) {
				prime.add(i);
			}
		}
		return prime;
    }

	private static boolean checkPrimeRM(long n,int k) {
		if(n<=4) {
			return n==2||n==3;
		}

		int s=0;
		long d=n-1;

		while((d&1) != 1) {
			d=d/2;
			s++;
		}

		for(int i=0;i<k;i++) {
			long a=2+(int)Math.random()*(n-4);
			if(isComposite(a,s,d,n)) {
				return false;
			}
		}

		return true;
	}

	private static boolean isComposite(long a, int s, long d, long n) {
		long x=power(a,d,n);

		if(x==1 || x==n-1) {
			return false;
		}

		for(int i=0;i<s;i++){
			if(x%(n-1)==0) {
				return false;
			}
			x=(x*x)%n;
		}

		return true;
	}

    public static HashSet<Long> getPrimeLtoR(int l,int r,List<Integer> prime) {
		if(l==1) l++;

		int[] arr=new int[r-l+1];

		Arrays.fill(arr,0);

		for(int i: prime ){

			if(i*i<=r) {

				int j=(l/i)*i;
				if(j<l)
					j+=i;
				for(;j<=r;j+=i) {
					if(j!=i)
						arr[j-l]=1;
				}
			}else {
				break;
			}

		}

		HashSet<Long> primeLtoR=new HashSet<>();

		for(int i=0;i<arr.length;i++) {
			if(arr[i]==0) {
				primeLtoR.add((i+l+0l));
			}
		}
		return primeLtoR;
	}
}


import java.util.*;
import java.io.*;
public class B {
    static class Scan {
        private byte[] buf=new byte[1024];
        private int index;
        private InputStream in;
        private int total;
        public Scan()
        {
            in=System.in;
        }
        public int scan()throws IOException
        {
            if(total<0)
            throw new InputMismatchException();
            if(index>=total)
            {
                index=0;
                total=in.read(buf);
                if(total<=0)
                return -1;
            }
            return buf[index++];
        }
        public int scanInt()throws IOException
        {
            int integer=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    integer*=10;
                    integer+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }
        public double scanDouble()throws IOException
        {
            double doub=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n)&&n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    doub*=10;
                    doub+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                double temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }
        public String scanString()throws IOException
        {
            StringBuilder sb=new StringBuilder();
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            while(!isWhiteSpace(n))
            {
                sb.append((char)n);
                n=scan();
            }
            return sb.toString();
        }
        private boolean isWhiteSpace(int n)
        {
            if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
            return true;
            return false;
        }
    }

    public static void sort(int arr[],int l,int r) {    //sort(arr,0,n-1);
        if(l==r) {
            return;
        }
        int mid=(l+r)/2;
        sort(arr,l,mid);
        sort(arr,mid+1,r);
        merge(arr,l,mid,mid+1,r);
    }
    public static void merge(int arr[],int l1,int r1,int l2,int r2) {
        int tmp[]=new int[r2-l1+1];
        int indx1=l1,indx2=l2;
        //sorting the two halves using a tmp array
        for(int i=0;i<tmp.length;i++) {
            if(indx1>r1) {
                tmp[i]=arr[indx2];
                indx2++;
                continue;
            }
            if(indx2>r2) {
                tmp[i]=arr[indx1];
                indx1++;
                continue;
            }
            if(arr[indx1]<arr[indx2]) {
                tmp[i]=arr[indx1];
                indx1++;
                continue;
            }
            tmp[i]=arr[indx2];
            indx2++;
        }
        //Copying the elements of tmp into the main array
        for(int i=0,j=l1;i<tmp.length;i++,j++) {
            arr[j]=tmp[i];
        }
    }

    public static void sort(long arr[],int l,int r) {    //sort(arr,0,n-1);
        if(l==r) {
            return;
        }
        int mid=(l+r)/2;
        sort(arr,l,mid);
        sort(arr,mid+1,r);
        merge(arr,l,mid,mid+1,r);
    }
    public static void merge(long arr[],int l1,int r1,int l2,int r2) {
        long tmp[]=new long[r2-l1+1];
        int indx1=l1,indx2=l2;
        //sorting the two halves using a tmp array
        for(int i=0;i<tmp.length;i++) {
            if(indx1>r1) {
                tmp[i]=arr[indx2];
                indx2++;
                continue;
            }
            if(indx2>r2) {
                tmp[i]=arr[indx1];
                indx1++;
                continue;
            }
            if(arr[indx1]<arr[indx2]) {
                tmp[i]=arr[indx1];
                indx1++;
                continue;
            }
            tmp[i]=arr[indx2];
            indx2++;
        }
        //Copying the elements of tmp into the main array
        for(int i=0,j=l1;i<tmp.length;i++,j++) {
            arr[j]=tmp[i];
        }
    }

    public static void main(String args[]) throws IOException {
        Scan input=new Scan();
        StringBuilder ans=new StringBuilder("");
        int test=input.scanInt();
//        boolean sq[]=new boolean[1000000005];
//        for(int i=1;i*i<sq.length;i++) {
//            sq[i*i]=true;
//        }
        for(int tt=1;tt<=test;tt++) {
            int n=input.scanInt();
            if(n%2==1) {
                ans.append("NO\n");
                continue;
            }
            n/=2;
            double sq=Math.sqrt(n);
            if(Math.floor(sq)==Math.ceil(sq)) {
                ans.append("YES\n");
                continue;
            }
            if(n%2==1) {
                ans.append("NO\n");
                continue;
            }
            n/=2;
            sq=Math.sqrt(n);
            if(Math.floor(sq)==Math.ceil(sq)) {
                ans.append("YES\n");
                continue;
            }
            ans.append("NO\n");
        }
        System.out.println(ans);
    }
}


import java.util.*;
import java.io.*;

public class _G14 {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int t = sc.nextInt();
        Set<Long> square = new HashSet<>();
        for (long i = 1; i <= (long) 1e5; i++) square.add(i * i);
        while (t-- > 0) {
            long n = sc.nextLong();
            if ((n % 2 ==0 && square.contains(n / 2))|| (n % 4 == 0 &&square.contains(n / 4))) {
                out.println("YES");
            } else {
                out.println("NO");
            }
        }
        out.close();
    }

    static void sort(int[] a) {
        ArrayList<Integer> q = new ArrayList<>();
        for (int i : a) q.add(i);
        Collections.sort(q);
        for (int i = 0; i < a.length; i++) a[i] = q.get(i);
    }

    static void sort(long[] a) {
        ArrayList<Long> q = new ArrayList<>();
        for (long i : a) q.add(i);
        Collections.sort(q);
        for (int i = 0; i < a.length; i++) a[i] = q.get(i);
    }

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.util.Set;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakharjain
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();

            int d = in.nextInt();

            int[] a = new int[n];

            Set<Integer> set = new HashSet<>();

            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();

            }

            int ans = 2;
            for (int i = 1; i < n; i++) {
                if (a[i] - a[i - 1] == 2 * d) {
                    ans++;
                } else if (a[i] - a[i - 1] > 2 * d) {
                    ans += 2;
                }
            }

            out.println(ans);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.util.*;
import java.io.*;

public class A {
	FastScanner in;
	PrintWriter out;
	boolean systemIO = true;

	public static void quickSort(int[] a, int from, int to) {
		if (to - from <= 1) {
			return;
		}
		int i = from;
		int j = to - 1;
		int x = a[from + (new Random()).nextInt(to - from)];
		while (i <= j) {
			while (a[i] < x) {
				i++;
			}
			while (a[j] > x) {
				j--;
			}
			if (i <= j) {
				int t = a[i];
				a[i] = a[j];
				a[j] = t;
				i++;
				j--;
			}
		}
		quickSort(a, from, j + 1);
		quickSort(a, j + 1, to);
	}

	public void solve() {
		int n = in.nextInt();
		HashSet<Long> ans = new HashSet<>();
		Long d = in.nextLong();
		long[] a = new long[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = in.nextInt();
		}
		for (int i = 0; i < a.length; i++) {
			long x = a[i] - d;
			boolean flag = true;
			for (int j = 0; j < a.length; j++) {
				if (Math.abs(a[j] - x) < d) {
					flag = false;
					break;
				}
			}
			if (flag) {
				ans.add(x);
			}
			x = a[i] + d;
			flag = true;
			for (int j = 0; j < a.length; j++) {
				if (Math.abs(a[j] - x) < d) {
					flag = false;
					break;
				}
			}
			if (flag) {
				ans.add(x);
			}
		}
		out.println(ans.size());
	}

	public void run() {

		try {
			if (systemIO) {
				in = new FastScanner(System.in);
				out = new PrintWriter(System.out);
			} else {
				in = new FastScanner(new File("input.txt"));
				out = new PrintWriter(new File("output.txt"));
			}
			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

	}

	// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
	public static void main(String[] args) {
		new A().run();
	}
}


/*
Keep solving problems.
*/

import java.util.*;
import java.io.*;

public class CFA {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    private static final long MOD = 1000L * 1000L * 1000L + 7;
    private static final int[] dx = {0, -1, 0, 1};
    private static final int[] dy = {1, 0, -1, 0};
    private static final String yes = "Yes";
    private static final String no = "No";

    void solve() throws IOException {
        int n = nextInt();
        long d = nextInt();
        long[] arr = nextLongArr(n);
        Set<Long> res = new HashSet<>();
        for (long cur : arr) {
            if (findMin(cur - d, arr) == d) {
                res.add(cur - d);
            }
            if (findMin(cur + d, arr) == d) {
                res.add(cur + d);
            }
        }

        outln(res.size());
    }

    long findMin(long cur, long[] arr) {
        long res = Long.MAX_VALUE;
        for (long v : arr) {
            res = Math.min(res, Math.abs(v - cur));
        }

        return res;
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }

    long gcd(long a, long b) {
        while(a != 0 && b != 0) {
            long c = b;
            b = a % b;
            a = c;
        }
        return a + b;
    }

    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    private void formatPrint(double val) {
        outln(String.format("%.9f%n", val));
    }
    public CFA() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CFA();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt(), d = s.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = s.nextInt();
		}
		Arrays.sort(arr);
		int count = 0;
		for(int i = 1; i < n; i++){
			int dist = arr[i] - arr[i - 1];
			if(dist > 2 * d){
				count += 2;
			}else if(dist == 2 * d){
				count++;
			}

		}
		System.out.println(count + 2);

	}

}


import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Main {

  private static void solve() {
    int n = ni();
    int d = ni();
    int[] a = na(n);
    Arrays.sort(a);

    Set<Integer> set = new HashSet<>();
    for (int i = 0; i < n; i ++) {
      int cand1 = a[i] - d;
      int cand2 = a[i] + d;
      int d1 = d;
      int d2 = d;
      for (int j = 0; j < n; j ++) {
        d1 = Math.min(d1, Math.abs(a[j] - cand1));
        d2 = Math.min(d2, Math.abs(a[j] - cand2));
      }
      if (d1 == d) {
        set.add(cand1);
      }
      if (d2 == d) {
        set.add(cand2);
      }
    }
    System.out.println(set.size());
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt(), d = in.nextInt();
            long a[] = in.parseLong1D(n);
            int cnt = 0;
            HashSet<Long> ans = new HashSet<>();
            for (long v : a) {
                long c = v - d;
                if (isPos(a, c, d)) ans.add(c);
                c = v + d;
                if (isPos(a, c, d)) ans.add(c);
            }
            out.println(ans.size());
        }

        private boolean isPos(long a[], long c, long d) {
            for (long v : a) {
                if (Math.abs(v - c) < d) return false;
            }
            return true;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int nextInt() {
            return readInt();
        }

        public long[] parseLong1D(int n) {
            long r[] = new long[n];
            for (int i = 0; i < n; i++) {
                r[i] = readLong();
            }
            return r;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


// package CF;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class F {

	public static void main(String[] args) throws Exception
	{
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt(), d = sc.nextInt();
		int [] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		TreeSet<Integer> set = new TreeSet<>();
		for (int i = 0; i < a.length; i++) {
			int tmp = a[i] - d;
			if(i == 0 || tmp > a[i-1] && tmp - a[i-1] >= d)
				set.add(tmp);
			tmp = a[i] + d;
			if(i == n-1 || tmp < a[i+1] && a[i+1] - tmp >= d)
				set.add(tmp);
 		}
		out.println(set.size());
		out.flush();
		out.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s)
		{
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader fileReader)
		{
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException
		{
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException
		{
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException
		{
			return br.readLine();
		}

		public boolean ready() throws IOException
		{
			return br.ready();
		}
	}
}


//package contests.CF495;

import java.io.*;
import java.util.HashSet;
import java.util.StringTokenizer;

public class A {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);

        int n = sc.nextInt();
        int d = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = sc.nextInt();
        }

        HashSet<Integer> set = new HashSet<>();
        for (int i = 0; i < arr.length; i++) {
            set.add(arr[i]+d);
            set.add(arr[i]-d);
        }

        int cnt = 0;
        for (int loc: set) {
            int minDist = (int)2e9;
            for (int i = 0; i < n; i++) {
                minDist = Math.min(minDist, Math.abs(arr[i]-loc));
            }

            if(minDist == d)
                cnt++;
        }

        pw.println(cnt);

        pw.flush();
        pw.close();
    }

    static int[][] packD(int n, int[] from, int[] to) {
        int[][] g = new int[n][];
        int[] p = new int[n];
        for (int f : from) if(f != -1) p[f]++;
        for (int i = 0; i < n; i++) g[i] = new int[p[i]];
        for (int i = 0; i < from.length; i++) if(from[i] != -1) {g[from[i]][--p[from[i]]] = to[i];}
        return g;
    }

    static void shuffle(int[] a)
    {
        int n = a.length;
        for(int i = 0; i < n; i++)
        {
            int r = i + (int)(Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }

    static class Scanner
    {
        StringTokenizer st; BufferedReader br;
        public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}
        public Scanner(String s) throws FileNotFoundException {	br = new BufferedReader(new FileReader(new File(s)));}
        public String next() throws IOException {while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());return st.nextToken();}
        public int nextInt() throws IOException {return Integer.parseInt(next());}
        public long nextLong() throws IOException {return Long.parseLong(next());}
        public String nextLine() throws IOException {return br.readLine();}
        public boolean ready() throws IOException {return br.ready();}
    }
}


import java.util.*;
import java.io.*;

public class A6
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int d = in.nextInt();
		int ans=2;

		int[] a = new int[n];

		for(int i=0;i<n;i++)
			a[i] = in.nextInt();

		for(int i=1;i<n;i++)
		{
			if(a[i]-a[i-1]>2*d)
			{
				ans += 2;
			}
			else if(a[i]-a[i-1]==2*d)
				ans += 1;
		}

		System.out.println(ans);
	}

}


import java.io.*;
import java.util.*;

public class A {
    String fileName = "<name>";

    public TreeSet<Integer> set = new TreeSet<>();

    public int getLowerDist(int x) {
        Integer higher = set.higher(x);
        Integer lower = set.lower(x);
        if (higher == null)
            return lower;
        if (lower == null)
            return higher;
        if (Math.abs(x - higher) < Math.abs(x - lower)) {
            return higher;
        } else {
            return lower;
        }
    }

    public void solve() throws IOException {
        int n = nextInt();
        int d = nextInt();
        int[] a = new int[n];
        Set<Integer> ans = new HashSet<>((int) 1e6, 1f);
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
            set.add(a[i]);
        }
        for (int i = 0; i < n; i++) {
            int pos1 = a[i] + d;
            int pos2 = a[i] - d;
            if (!set.contains(pos1) && Math.abs(pos1 - getLowerDist(pos1)) == d) {
                ans.add(pos1);
            }
            if (!set.contains(pos2) && Math.abs(pos2 - getLowerDist(pos2)) == d) {
                ans.add(pos2);
            }
        }
        out.print(ans.size());
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    public String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new A().run();
    }
}


import java.util.*;
public class Hotels {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int[] cities = new int[n];
		int d = input.nextInt();
		for (int i = 0; i<n; i++) {
			cities[i] = input.nextInt();
		}
		int possibilities = 0;
		ArrayList<Integer> newHotels = new ArrayList<Integer>();
		for (int i = 0; i<n; i++) {
			int plusD = cities[i]+d;
			if (newHotels.indexOf(cities[i]+d)==-1 && minDist(plusD,cities)==d) {
				possibilities++;
				newHotels.add(cities[i]+d);
			}
			if (newHotels.indexOf(cities[i]-d)==-1 && minDist(cities[i]-d,cities)==d) {
				possibilities++;
				newHotels.add(cities[i]-d);
			}
		}
		System.out.println(possibilities);
	}
	public static int minDist(int a, int[] arr) {
		int minDist = Integer.MAX_VALUE;
		for (int i=0; i<arr.length; i++) {
			minDist = Math.min(Math.abs(arr[i]-a), minDist);
	}
		return minDist;
	}

}


import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class main {
    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        int n = nextInt();
        int d = nextInt();
        int ans = 2;
        int b[] = new int [n];
        Arrays.sort(b);
        for (int i = 0; i < n; i++) {
            b[i] = nextInt();
        }
        for (int i = 1; i < n; i++) {
            if (b[i] - b[i - 1] >= d * 2) {
                ans++;
            }
            if (b[i] - b[i - 1] > d * 2) {
                ans++;
            }
        }
        pw.println(ans);
        pw.close();
    }
    static BufferedReader br;
    static StringTokenizer st = new StringTokenizer("");

    public static int nextInt() throws IOException {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return Integer.parseInt(st.nextToken());
    }
    public static String next() throws IOException {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    public static double nextDouble() throws IOException {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return Double.parseDouble(st.nextToken());
    }
    public static long nextLong() throws IOException {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return Long.parseLong(st.nextToken());
    }
}


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class A {
    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        // Scanner scan = new Scanner(System.in);
        // PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        // int n = Integer.parseInt(bf.readLine());
        StringTokenizer st = new StringTokenizer(bf.readLine());
        // int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());
        int n = Integer.parseInt(st.nextToken());
        int d = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(bf.readLine());
        int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());
        int ans = 2;
        for(int i=0; i<n-1; i++) {
          int diff = a[i+1]-a[i];
          if(diff == 2*d) ans++;
          else if(diff > 2*d) ans += 2;

        }
        System.out.println(ans);
        // int n = scan.nextInt();

        // out.close(); System.exit(0);
    }
}


import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.BigInteger;
import java.math.BigDecimal;

public class Main {

    static class Task {

        void solve(int test, FastScanner in, PrintWriter out) throws IOException {
            int n = in.nextInt();
            int d = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }

            Arrays.sort(a);

            int ans = 2;
            for (int i = 0; i < n - 1; i++) {
                if (a[i + 1] - d > a[i] + d) {
                    ans += 2;
                } else if (a[i + 1] - d >= a[i] + d) {
                    ans++;
                }
            }

            out.println(ans);
        }
    }

    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        FastScanner in = new FastScanner("input.txt");
//        PrintWriter out = new PrintWriter(new FileWriter("output.txt"));
        new Task().solve(1, in, out);
        out.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer token;

        public FastScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String nextToken() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return token.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {

	static StringTokenizer st;
	static BufferedReader br;
	static PrintWriter pw;
	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		int n = nextInt();
		int d = nextInt();
		int[]x = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = nextInt();
		}
		int ans = 2;
		for (int i = 1; i < n; i++) {
			if (x[i]-x[i-1]==2*d)
				ans++;
			else if (x[i]-x[i-1] > 2*d)
				ans += 2;
		}
		System.out.println(ans);
		pw.close();
	}
	private static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}
	private static long nextLong() throws IOException {
		return Long.parseLong(next());
	}
	private static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}
	private static String next() throws IOException {
		while (st==null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

import static java.lang.Math.*;

public class Main implements Runnable {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new Main(),"Main",1<<26).start();
    }
    public void run() {
        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);

        int n = sc.nextInt();
        long d = sc.nextLong();

        long a[] = new long[n];
        for(int i = 0; i < n; ++i)
            a[i] = sc.nextLong();

        int ans = 0;

        for(int i = 1; i < n; ++i) {
            if(a[i] - a[i - 1] > 2 * d)
                ans += 2;
            else if(a[i] - a[i - 1] == 2 * d)
                ans++;
        }

        ans += 2;

        w.print(ans);

        w.close();
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Set;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskA solver = new TaskA();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskA {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      int n = in.nextInt();
      int d = in.nextInt();
      Set<Integer> pts = new HashSet<>();
      int[] x = in.nextIntArray(n);
      for (int i = 0; i < n; i++) {
        pts.add(x[i] - d);
        pts.add(x[i] + d);
      }
      Set<Integer> ans = new HashSet<>();
      for (int pt : pts) {
        int min = (int) (1e9 + 10);
        for (int i = 0; i < n; i++) {
          min = Math.min(Math.abs(x[i] - pt), min);
        }
        if (min >= d) {
          ans.add(pt);
        }
      }
      out.println(ans.size());
    }

  }

  static class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1 << 13];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (this.numChars == -1) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return -1;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public int nextInt() {
      int c;
      for (c = this.read(); isSpaceChar(c); c = this.read()) {
      }

      byte sgn = 1;
      if (c == 45) {
        sgn = -1;
        c = this.read();
      }

      int res = 0;

      while (c >= 48 && c <= 57) {
        res *= 10;
        res += c - 48;
        c = this.read();
        if (isSpaceChar(c)) {
          return res * sgn;
        }
      }

      throw new InputMismatchException();
    }

    public static boolean isSpaceChar(int c) {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;
    }

    public int[] nextIntArray(int n) {
      int[] arr = new int[n];
      for (int i = 0; i < n; i++) {
        arr[i] = nextInt();
      }
      return arr;
    }

  }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int d = in.nextInt();
            int[] x = new int[n + 1];

            int ans = 2;

            for (int i = 1; i <= n; i++) x[i] = in.nextInt();

            for (int i = 1; i < n; i++) {
                ans += (x[i + 1] - x[i] >= 2 * d) ? (x[i + 1] - x[i] == 2 * d ? 1 : 2) : 0;
            }
            out.print(ans);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            boolean isSpaceChar(int ch);

        }

    }
}


import javafx.collections.transformation.SortedList;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Array;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {

        Scan scan = new Scan();
        int n = scan.scanInt();
        long d = scan.scanLong();
        long a[]=new long[n];
        for(int i=0;i<n;i++){
            a[i]=scan.scanLong();
        }
        Arrays.sort(a);
        int count=0;
        for(int i=0;i<n-1;i++){
            if((a[i+1]-d)>(a[i]+d)){
                count+=2;
            }else if((a[i+1]-d)==(a[i]+d)){
                count++;
            }
        }
        count+=2;
        System.out.println(count);
    }

    static class Scan
    {

        private byte[] buf=new byte[1024];
        private int index;
        private InputStream in;
        private int total;

        public Scan()
        {
            in=System.in;
        }

        public int scan()throws IOException
        {
            if(total<0)
                throw new InputMismatchException();
            if(index>=total)
            {
                index=0;
                total=in.read(buf);
                if(total<=0)
                    return -1;
            }
            return buf[index++];
        }
        public int scanInt()throws IOException
        {
            int integer=0;
            int n=scan();
            while(isWhiteSpace(n))
                n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    integer*=10;
                    integer+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }

        public char scanchar()throws IOException
        {
            int n=scan();
            while(isWhiteSpace(n))
                n=scan();
            return (char)n;
//            int neg=1;
//            while(!isWhiteSpace(n))
//            {
//                if(n>='0'&&n<='9')
//                {
//                    integer*=10;
//                    integer+=n-'0';
//                    n=scan();
//                }
//                else throw new InputMismatchException();
//            }
//            return neg*integer;
        }

        public long scanLong()throws IOException
        {
            long lng=0;
            int n=scan();
            while(isWhiteSpace(n))
                n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n) && n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    lng*=10;
                    lng+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                long temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        lng+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return neg*lng;
        }
        public double scanDouble()throws IOException
        {
            double doub=0;
            int n=scan();
            while(isWhiteSpace(n))
                n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n)&&n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    doub*=10;
                    doub+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                double temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }
        public String scanString()throws IOException
        {
            StringBuilder sb=new StringBuilder();
            int n=scan();
            while(isWhiteSpace(n))
                n=scan();
            while(!isWhiteSpace(n))
            {
                sb.append((char)n);
                n=scan();
            }
            return sb.toString();
        }
        private boolean isWhiteSpace(int n)
        {
            if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
                return true;
            return false;
        }
    }

}


//package que_a;

import java.io.*;
import java.util.*;
import java.math.*;

public class utkarsh {

    InputStream is;
    PrintWriter out;

    long mod = (long) (1e9 + 7);
    boolean SHOW_TIME;

    void solve() {
        //Enter code here utkarsh
        //SHOW_TIME = true;
        int n = ni();
        int d = ni();
        int a[] = na(n);
        Arrays.sort(a);
        int ans = 2;
        for(int i = 0; i < n-1; i++) {
            if(a[i+1] - a[i] == (2 * d))    ans++;
            else if(a[i+1] - a[i] > (2 * d))    ans += 2;
        }
        out.println(ans);
    }

    //---------- I/O Template ----------

    public static void main(String[] args) { new utkarsh().run(); }
    void run() {
        is = System.in;
        out = new PrintWriter(System.out);
        long start = System.currentTimeMillis();
        solve();
        long end = System.currentTimeMillis();
        if(SHOW_TIME) out.println("\n" + (end - start) + " ms");
        out.flush();
    }

    byte input[] = new byte[1024];
    int len = 0, ptr = 0;

    int readByte() {
        if(ptr >= len) { ptr = 0;
            try { len = is.read(input); }
            catch(IOException e) { throw new InputMismatchException(); }
            if(len <= 0) { return -1; }
        } return input[ptr++];
    }
    boolean isSpaceChar(int c) { return !( c >= 33 && c <= 126 ); }
    int skip() {
        int b = readByte();
        while(b != -1 && isSpaceChar(b)) { b = readByte(); }
        return b;
    }

    char nc() { return (char)skip(); }
    String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    String nLine() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while( !(isSpaceChar(b) && b != ' ') ) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    int ni() {
        int n = 0, b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        if(b == -1) { return -1; }  //no input
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }
    long nl() {
        long n = 0L;    int b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }

    double nd() { return Double.parseDouble(ns()); }
    float nf() { return Float.parseFloat(ns()); }
    int[] na(int n) {
        int a[] = new int[n];
        for(int i = 0; i < n; i++) { a[i] = ni(); }
        return a;
    }
    char[] ns(int n) {
        char c[] = new char[n];
        int i, b = skip();
        for(i = 0; i < n; i++) {
            if(isSpaceChar(b)) { break; }
            c[i] = (char)b; b = readByte();
        } return i == n ? c : Arrays.copyOf(c,i);
    }
}


//package CodeforcesJava;

import java.io.*;
import java.util.*;

public class Main {

    public void solve(InputProvider input, PrintWriter output) throws IOException {
        int n = input.nextInt();
        int d = input.nextInt();
        int count = 1;
        int current = input.nextInt();
        for (int i = 1; i < n; i++) {
            int x = input.nextInt();
            if (x - current == d * 2) {
                count++;
            } else if (x - current > d * 2) {
                count += 2;
            }
            current = x;
        }
        count++;
        output.print(count);
    }

    public static void main(String[] args) throws Exception {
        try (InputProvider input = new InputProvider(System.in);
             PrintWriter output = new PrintWriter(System.out)) {
            new Main().solve(input, output);
        }
    }

    public static class InputProvider implements AutoCloseable {

        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputProvider(Reader reader) {
            this.reader = new BufferedReader(reader);
        }

        public InputProvider(InputStream input) {
            reader = new BufferedReader(new InputStreamReader(input));
        }

        public String next() throws IOException {
            if (Objects.isNull(tokenizer) || !tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public String nextLine() throws IOException {
            return reader.readLine();
        }

        @Override
        public void close() throws Exception {
            reader.close();
        }

    }

}


import java.io.*;
import java.util.*;

public class A {
	public static boolean ok(int []x,int d,int X)
	{
		for(int i=0;i<x.length;i++)
			if(Math.abs(x[i]-X)<d)
				return false;
		return true;
	}
	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		int ans=0;
		int n=sc.nextInt(),d=sc.nextInt();
		TreeSet<Integer> set=new TreeSet();
		int []x=new int [n];
		for(int i=0;i<n;i++)
			x[i]=sc.nextInt();
		for(int i=0;i<n;i++)
		{
			int x1=x[i]+d;
			if (ok(x,d,x1))
				set.add(x1);
			x1=x[i]-d;
			if (ok(x,d,x1))
				set.add(x1);

		}
		pw.println(set.size());

		pw.close();

	}

	static class Scanner
	{
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream s) {
		br = new BufferedReader(new InputStreamReader(s));
	}
	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	public Scanner(String s) throws FileNotFoundException {
		br = new BufferedReader(new FileReader(s));
	}
	public int nextInt() throws IOException {
		return Integer.parseInt(next());
	}
	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

	public boolean ready() throws IOException {
		return br.ready();
	}
}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ankur
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long k = in.nextLong();
            HashMap<Long, Integer> hm = new HashMap<>();
            long ar[] = in.nextLongArray(n);
            for (int i = 0; i < n; i++) {
                long dist = ar[i] + k;
                long min = k;
                for (int j = 0; j < n; j++) {
                    min = Math.min(min, Math.abs(ar[j] - dist));
                }
                if (min == k) {
                    hm.put(dist, 1);
                }
                dist = ar[i] - k;
                min = k;
                for (int j = 0; j < n; j++) {
                    min = Math.min(min, Math.abs(ar[j] - dist));
                }
                if (min == k) {
                    hm.put(dist, 1);
                }
            }
            out.print(hm.size());
        }

    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar;
        private int snumChars;

        public InputReader(InputStream st) {
            this.stream = st;
        }

        public int read() {
            //*-*------clare------
//remeber while comparing 2 non primitive data type not to use ==
//remember Arrays.sort for primitive data has worst time case complexity of 0(n^2) bcoz it uses quick sort
//again silly mistakes ,yr kb tk krta rhega ye mistakes
//try to write simple codes ,break it into simple things
//knowledge>rating
        /*
        public class Main
        implements Runnable{
    public static void main(String[] args) {
        new Thread(null,new Main(),"Main",1<<26).start();

    }
    public void run() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();//chenge the name of task
        solver.solve(1, in, out);
        out.close();
    }
         */

            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long[] nextLongArray(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextLong();
            }
            return a;
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class AA {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt();
		int d =sc.nextInt();
		int[] hotels = new int[n];
		for (int i = 0; i < hotels.length; i++) {
			hotels[i] = sc.nextInt();
		}
		int count = 0;
		for (int i = 0; i < hotels.length-1; i++) {
			int one = hotels[i];
			int two = hotels[i+1];
			double mid = (two-one)*1.0/2.0;
			if(mid==d) {
				count++;
//				System.out.println("hello"+" "+i+" "+(i+1));
			}
			else if(mid>d) {
//				System.out.println("hello2"+" "+i+" "+(i+1));
				count+=2;

			}

		}
		count+=2;
		System.out.println(count);

		out.flush();
		out.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}//19 91 991 919 199

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}


import java.io.*;
import java.util.*;

public class TaskA
{
	public static void main(String[] args)
	{
		new TaskA(System.in, System.out);
	}

	static class Solver implements Runnable
	{
		int n, d;
		long[] arr;
//		BufferedReader in;
		InputReader in;
		PrintWriter out;

		void solve() throws IOException
		{
			n = in.nextInt();
			d = in.nextInt();
			arr = in.nextLongArray(n);

			Set<Long> set = new HashSet<>();

			for (int i = 0; i < n; i++)
			{
				if (i == 0)
					set.add(arr[i] - d);
				else
				{
					long left = arr[i] - d;

					if (left - arr[i - 1] >= d)
						set.add(left);
				}

				if (i == n - 1)
					set.add(arr[i] + d);
				else
				{
					long right = arr[i] + d;

					if (arr[i + 1] - right >= d)
						set.add(right);
				}
			}

			out.println(set.size());
		}

		void debug(Object... o)
		{
			System.err.println(Arrays.deepToString(o));
		}

//		uncomment below line to change to BufferedReader
//		public Solver(BufferedReader in, PrintWriter out)
		public Solver(InputReader in, PrintWriter out)
		{
			this.in = in;
			this.out = out;
		}

		@Override
		public void run()
		{
			try
			{
				solve();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
		}

	}

	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public int read()
		{
			if (numChars == -1)
				throw new InputMismatchException();

			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}

			return buf[curChar++];
		}

		public int nextInt()
		{
			int c = read();

			while (isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();

				res *= 10;
				res += c & 15;

				c = read();
			} while (!isSpaceChar(c));

			return res * sgn;
		}

		public int[] nextIntArray(int arraySize)
		{
			int array[] = new int[arraySize];

			for (int i = 0; i < arraySize; i++)
				array[i] = nextInt();

			return array;
		}

		public long nextLong()
		{
			int c = read();

			while (isSpaceChar(c))
				c = read();

			int sign = 1;

			if (c == '-')
			{
				sign = -1;

				c = read();
			}

			long result = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();

				result *= 10;
				result += c & 15;

				c = read();
			} while (!isSpaceChar(c));

			return result * sign;
		}

		public long[] nextLongArray(int arraySize)
		{
			long array[] = new long[arraySize];

			for (int i = 0; i < arraySize; i++)
				array[i] = nextLong();

			return array;
		}

		public float nextFloat()
		{
			float result, div;
			byte c;

			result = 0;
			div = 1;
			c = (byte) read();

			while (c <= ' ')
				c = (byte) read();

			boolean isNegative = (c == '-');

			if (isNegative)
				c = (byte) read();

			do
			{
				result = result * 10 + c - '0';
			} while ((c = (byte) read()) >= '0' && c <= '9');

			if (c == '.')
				while ((c = (byte) read()) >= '0' && c <= '9')
					result += (c - '0') / (div *= 10);

			if (isNegative)
				return -result;

			return result;
		}

		public double nextDouble()
		{
			double ret = 0, div = 1;
			byte c = (byte) read();

			while (c <= ' ')
				c = (byte) read();

			boolean neg = (c == '-');

			if (neg)
				c = (byte) read();

			do
			{
				ret = ret * 10 + c - '0';
			} while ((c = (byte) read()) >= '0' && c <= '9');

			if (c == '.')
				while ((c = (byte) read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);

			if (neg)
				return -ret;

			return ret;
		}

		public String next()
		{
			int c = read();

			while (isSpaceChar(c))
				c = read();

			StringBuilder res = new StringBuilder();

			do
			{
				res.appendCodePoint(c);

				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		}

		public String nextLine()
		{
			int c = read();

			StringBuilder result = new StringBuilder();

			do
			{
				result.appendCodePoint(c);

				c = read();
			} while (!isNewLine(c));

			return result.toString();
		}

		public boolean isNewLine(int c)
		{
			return c == '\n';
		}

		public boolean isSpaceChar(int c)
		{
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public void close()
		{
			try
			{
				stream.close();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
		}

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

	}

	static class CMath
	{
		static long power(long number, long power)
		{
			if (number == 1 || number == 0 || power == 0)
				return 1;

			if (power == 1)
				return number;

			if (power % 2 == 0)
				return power(number * number, power / 2);
			else
				return power(number * number, power / 2) * number;
		}

		static long modPower(long number, long power, long mod)
		{
			if (number == 1 || number == 0 || power == 0)
				return 1;

			number = mod(number, mod);

			if (power == 1)
				return number;

			long square = mod(number * number, mod);

			if (power % 2 == 0)
				return modPower(square, power / 2, mod);
			else
				return mod(modPower(square, power / 2, mod) * number, mod);
		}

		static long moduloInverse(long number, long mod)
		{
			return modPower(number, mod - 2, mod);
		}

		static long mod(long number, long mod)
		{
			return number - (number / mod) * mod;
		}

		static int gcd(int a, int b)
		{
			if (b == 0)
				return a;
			else
				return gcd(b, a % b);
		}

		static long min(long... arr)
		{
			long min = arr[0];

			for (int i = 1; i < arr.length; i++)
				min = Math.min(min, arr[i]);

			return min;
		}

		static long max(long... arr)
		{
			long max = arr[0];

			for (int i = 1; i < arr.length; i++)
				max = Math.max(max, arr[i]);

			return max;
		}

		static int min(int... arr)
		{
			int min = arr[0];

			for (int i = 1; i < arr.length; i++)
				min = Math.min(min, arr[i]);

			return min;
		}

		static int max(int... arr)
		{
			int max = arr[0];

			for (int i = 1; i < arr.length; i++)
				max = Math.max(max, arr[i]);

			return max;
		}

	}

	static class Utils
	{
		static boolean nextPermutation(int[] arr)
		{
			for (int a = arr.length - 2; a >= 0; --a)
			{
				if (arr[a] < arr[a + 1])
				{
					for (int b = arr.length - 1; ; --b)
					{
						if (arr[b] > arr[a])
						{
							int t = arr[a];

							arr[a] = arr[b];
							arr[b] = t;

							for (++a, b = arr.length - 1; a < b; ++a, --b)
							{
								t = arr[a];
								arr[a] = arr[b];
								arr[b] = t;
							}

							return true;
						}
					}
				}
			}

			return false;
		}

	}

	public TaskA(InputStream inputStream, OutputStream outputStream)
	{
//		uncomment below line to change to BufferedReader
//		BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Thread thread = new Thread(null, new Solver(in, out), "TaskA", 1 << 29);

		try
		{
			thread.start();
			thread.join();
		}
		catch (InterruptedException e)
		{
			e.printStackTrace();
		}
		finally
		{
			in.close();
			out.flush();
			out.close();
		}
	}

}