import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        int n = reader.nextInt();
        int[] P = new int[n];
        for (int i=0; i<n; i++) P[i] = reader.nextInt();
        int ans = 0;
        for (int i=1; i<n-1; i++) {
            if (P[i-1]<P[i] && P[i]<P[i+1]) ans++;
            if (P[i-1]>P[i] && P[i]>P[i+1]) ans++;
        }
        System.out.println(ans);
    }

    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}

        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		int result = 0;

		String str[] = br.readLine().split(" ");
		int list[] = new int[n];

		for (int i = 0; i < n; i++) {
			list[i] = Integer.parseInt(str[i]);
		}

		for (int i = 1; i < n - 1; i++) {
			if (list[i - 1] < list[i] && list[i] < list[i + 1]) {
				result++;
			} else if (list[i - 1] > list[i] && list[i] > list[i + 1]) {
				result++;
			}
		}
		System.out.println(result);
	}
}


import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		  int N = nextInt();
		  ArrayList<Integer> list = nextIntArray();
		  int count = 0;
		  for(int i = 1; i < N - 1; i++){
		    if((list.get(i - 1) < list.get(i) && list.get(i) < list.get(i + 1)) || (list.get(i - 1) > list.get(i) && list.get(i) > list.get(i + 1)){
		      count++;
		    }
		  }
		  myout(count);
	}
	//Method addition frame start

	//Method addition frame end
}


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      	int[] a = new int[n];
      	int mid = 0;
      	int count = 1;
        for(int i = 0; i < a.length; ++i){
          a[i] = sc.nextInt();
        }
        for(int i = 0; i <(n-1); i++){
            mid = a[(i+1)];
            if(mid > a[i] && mid < a[(i+2)]){
            count += 1;
            }if(mid < a[i] && mid > a[(i+2)]){
            count += 1;
            }
        }

      System.out.println(count);
    }
}


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      	int[] p = new int[n];
      	int mid = 0;
      	int count = 1;
        for(int i = 0; i < a.length; ++i){
          p[i] = sc.nextInt();
        }
        for(int i = 0; i <(n-2); i++){
            mid = p[(i+1)];
            if(mid > p[i] && mid < p[(i+2)]){
            count += 1;
            }if(mid < p[i] && mid > p[(i+2)]){
            count += 1;
            }
        }

      System.out.println(count);
    }
}


#include<cstdio>
int aa[30];
int main()
{
	int n;
	while(~scanf("%d",&n))
	{
		int i;
		for(i=0;i<n;i++)
		{
			scanf("%d",&aa[i]);
		}
		int num=0;
		for(i=1;i<=n-2;i++)
		{
			if(aa[i]>aa[i-1]&&aa[i]<aa[i+1]||aa[i]<aa[i-1]&&aa[i]>aa[i+1])
			num++;
		}
		printf("%d\n",num);

	}
	return 0;
}


#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<int> > mat;

int main()
{
  int n;
  cin >> n;
  int p[30];
  for (int i = 0; i < n; i++)
  {
    cin >> p[i];
  }
  int ans = 0;
  for (int i = 0; i < n - 2; i++)
  {
    if (p[i] < p[i + 1] && p[i + 1] < p[i + 2])
    {
      ans++;
    }
    if (p[i] > p[i + 1] && p[i + 1] > p[i + 2])
    {
      ans++;
    }
  }
  cout << ans << "\n";
}


#include <bits/stdc++.h>
using namespace std;

#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;

int main() {
    lli n;
    cin >> n;
    lli p[n];
    REP(i, 0, n) {
        cin >> p[i];
    }
    lli ans = 0;
    REPE(i, 1, n-2) {
        if ((p[i-1] < p[i] && p[i+1] > p[i]) ||
            (p[i-1] > p[i] && p[i+1] < p[i])) {
            ans++;
        }
    }
    cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 1000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	int n;
	cin >> n;
	int cnt = 0;
	int suma = 0;
	if(n%2){
		suma++;
	}
	cnt = (n/2)+1;
	cout << cnt << endl;
	return 0;
}


#include <stdio.h>
int main()
{
  int r,count=0;
  scanf("%d",&r);
  int ar[r];
  for(int i=0;i<r;i++)
  {
    scanf("%d",&ar[i]);
  }
  for(int i=1;i<r-1;i++)
  {
    if((ar[i-1]<ar[i])&&(ar[i]<ar[i+1]))
    {
      count++;
    }
  else((ar[i-1]>ar[i])&&(ar[i]>ar[i+1]));
  {
    count++;
  }

  }
  printf("%d\n",count);
  return 0;
  }


#include <stdio.h>
int main()
{
  int r,count=0;
  scanf("%d",&r);
  int ar[r];
  for(int i=0;i<r;i++)
  {
    scanf("%d",&ar[i]);
  }
  for(int i=1;i<r-1;i++)
  {
    if((ar[i-1]<ar[i])&&(ar[i]<ar[i+1]))
    {
      count++;
    }
  else((ar[i-1]>ar[i])&&(ar[i]>ar[i+1]))
  {
    count++;
  }

  }
  printf("%d\n",count);
  return 0;
  }


#include <stdio.h>

int main(){
	int n;
	int p[30];
	int count=0;

	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&p[i]);
	}
	for(int i=1;i<n-1;i++){
		if(p[i-1]<p[i]&&p[i+1]>p[i]){
			count++;
		}else if(p[i-1]>p[i]&&p[i+1]<p[i]){
			count++;
		}
	}
	printf("%d\n",count);
}


#include<stdio.h>

int main(void){
  int i,n,count=0;
    scanf("%d",&n);
  int p[n];
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
  }

  for(i=0;i<n-2;i++){
    if((p[i]<p[i+1])&&(p[i+1]<p[i+2])){
      count+=1;
    }
    else if((p[i]>p[i+1])&&(p[i+1]>p[i+2])){
      count+=1;
    }
  }

  printf("%d\n",count);

  return 0;
}


#include<stdio.h>
int main()
{
	int p[100],n,num=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&p[i]);
	}
	for(int i=0;i<n-2;i++){
		if(p[i]<p[i+1] && p[i+1]<p[i+2] || p[i]>p[i+1] && p[i+1]>p[i+2]){
			num++;
		}
	}
	printf("%d\n",num);
	return 0;
}


#include <stdio.h>
#define size 100000
int main() {

    int N,A[size],i,count=0,a,b,c;
    scanf("%d",&N);
    for(i=1;i<N;i++){
        scanf("%d",&A[i]);
    }
    for(i=2;i<N;i++){
        a=A[i-1];
        b=A[i];
        c=A[i+1];
        if(b>a && b<c || b<a && b>c){
        count ++;
        }
    }

    printf("%d\n",count);

    return 0;
}


#include <stdio.h>
#define size 100000
int main() {

    int N,A[size],i,count=0,a,b,c;
    scanf("%d",&N);
    for(i=1;i<N;i++){
        scanf("%d",&A[i]);
    }
    for(i=2;i<N;i++){
        a=A[i-1];
        b=A[i];
        c=A[i+1];
        if(b>=a && b<=c || b<=a && b>=c){
        count ++;
        }
    }

    printf("%d\n",count);

    return 0;
}


#include<stdio.h>

int main( )
{
    int n , num[100] , count = 0  , i ;
    scanf("%d" , &n);

    for( i = 1 ; i <= n ; i++)
        scanf("%d" , &num[i]);

    for( i = 1 ; i < n ; i++)
    {
        if( num[i] < num[i+1])
        {
            if( num[i+1] < num[i+2])
                count++ ;
        }

        else if( num[i] > num[i+1] )
        {
                if( num[i+1] > num[i+2])
                    count++ ;
        }
    }

    printf("%d\n" , count);

    return 0 ;
}


'use strict'
const Main = (arg) => {
  let input = arg.trim().split('\n');
  let n = parseInt(input[0]);
  let pArr = input[1].split(' ').map(Number);
  // console.log({ n, pArr });
  let count = 0;
  for (let i = 1; i - 1 < n; i++) {
    if ((pArr[i - 1] < pArr[i] && pArr[i] < pArr[i + 1])
      || (pArr[i + 1] < pArr[i] && pArr[i] < pArr[i - 1])) {
      count += 1;
    }
  }
  console.log(count);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


'use strict'

function main(input){
    const N = Number(input[0]);
    const P = input[1].split(' ').map(Number);
    let ans = 0;
    for(let i=0;i<N-2;i++){
        if((P[i+1]-P[i])*(P[i+2]-P[i+1])>0) ans++;
    }
    console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').split('\n'))


// inputに入力データ全体が入る
function Main(input) {
  lines = input.split("\n");
  numbers = lines[1].split(" ");
  iterations = numbers.length;
  count = 0;

  for(i=0; i<iterations-2; i++){
    var max = Math.max(numbers[0], numbers[1], numbers[2]);
    var min = Math.min(numbers[0], numbers[1], numbers[2]);
    if(numbers[1] != max && numbers[1] != min){
      count += 1;
    }

    numbers.splice(0,1);
  }

  console.log(count);

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {
	input = input.split("\n");
	var arr = input[1].split(" ");
	var sum = 0;
	for(var i=1;i<arr.length-1;i++){
		if((arr[i-1]<arr[i]&&arr[i]<arr[i+1])||(arr[i-1]>arr[i]&&arr[i]>arr[i+1])){
			sum++;
		}
	}
	console.log(sum);
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


function Main(input){
var row = input.split("\n")[1].split(" ");
var count = 0;
for(i=0;i<=(row.length-2);i++){
  if(row[i-1]<row[i]&&row[i]<row[i+1] ||
     row[i-1]>row[i]&&row[i]>row[i+1]){
       count +=1;
     }
}
console.log(count);
}
  Main(require('fs').readFileSync('/dev/stdin','utf8'));


package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var n int
	fmt.Fscan(read, &n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(read, &a[i])
	}

	cnt := 0
	for i := 1; i < n-1; i++ {
		if a[i-1] < a[i] && a[i] < a[i+1] {
			cnt++
		}
		if a[i-1] > a[i] && a[i] > a[i+1] {
			cnt++
		}
	}
	fmt.Fprintln(write, cnt)
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"reflect"
	"sort"
	"strconv"
	"strings"
	// "regexp"
)

/* sort */
type pair struct {
	index  int64
	p1, p2 interface{}
}
type pairs []pair

func (slice pairs) Len() int {
	return len(slice)
}

func (slice pairs) Less(i, j int) bool {
	return slice[i].index < slice[j].index
}

func (slice pairs) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}

/* sort */
type Int64Slice []int64

func (slice Int64Slice) Len() int {
	return len(slice)
}

func (slice Int64Slice) Less(i, j int) bool {
	return slice[i] < slice[j]
}

func (slice Int64Slice) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}
func Int64s(a []int64)                    { sort.Sort(Int64Slice(a)) }
func Int64sSliceAreSorted(a []int64) bool { return sort.IsSorted(Int64Slice(a)) }

const (
	initialBufSize = 1e4
	maxBufSize     = 1e8
	INF            = 1e8
)

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriter(os.Stdout)
	di      = []int64{-1, 0, 1, 0}
	dj      = []int64{0, -1, 0, 1}
)

func main() {
	buf := make([]byte, initialBufSize)
	scanner.Buffer(buf, maxBufSize)
	scanner.Split(bufio.ScanWords)
	n := readInt()
	A := make([]int64, n)
	for i := int64(0); i < n; i++ {
		A[i] = readInt()
	}
	ok := 0
	for i := int64(1); i < n-1; i++ {
		_, mid, _ := max3(A[i-1], A[i], A[i+1])
		if mid == A[i] {
			ok++
		}
	}
	fmt.Println(ok)
}

/*==========================================
 *             Library
 *==========================================*/
func max3(a int64, b int64, c int64) (int64, int64, int64) {
	sort := []int64{a, b, c}
	Int64s(sort)
	return sort[2], sort[1], sort[0]
}
func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}
func doubleAry(h int64, w int64, init int64) (res [][]int64) {
	res = make([][]int64, h)
	for i := int64(0); i < h; i++ {
		res[i] = make([]int64, w)
		for j := int64(0); j < w; j++ {
			res[i][j] = init
		}
	}
	return
}

func aryEq(a []int64, b []int64) bool {
	return reflect.DeepEqual(a, b)
}

func clone(n []int64) (r []int64) {
	r = make([]int64, len(n))
	for i := 0; i < len(n); i++ {
		r[i] = n[i]
	}
	return
}
func write(s string) {
	writer.WriteString(s)
}

func print() {
	writer.Flush()
}

// scanner.Split(bufio.ScanWords) をコメントアウトしないと使用不可
func readLine() (s string) {
	if scanner.Scan() {
		s = scanner.Text()
	}
	return s
}

func readInt() (read int64) {
	scanner.Scan()
	read, err := strconv.ParseInt(scanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return
}

func readFloat() (read float64) {
	scanner.Scan()
	read, err := strconv.ParseFloat(scanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return
}

func readRunes() (read []rune) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, v)
	}
	return
}

func readString() (read string) {
	scanner.Scan()
	read = scanner.Text()
	return
}

func readStrings() (read []string) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, string(v))
	}
	return
}

func s2i(s string) int64 {
	var intVal, e = strconv.ParseInt(s, 10, 64)
	if e != nil {
		panic(e)
	}
	return intVal
}

func i2s(i int64) string {
	var strVal = strconv.FormatInt(i, 10)
	return strVal
}

func s2f(s string) float64 {
	var floatVal, e = strconv.ParseFloat(s, 64)
	if e != nil {
		panic(e)
	}
	return floatVal
}

func abs(i int64) int64 {
	return int64(math.Abs(float64(i)))
}

func sum(i []int64) int64 {
	sum := int64(0)
	for _, val := range i {
		sum += val
	}
	return sum
}

func split(s string) []string {
	return strings.Fields(s)
}

func strAry2intAry(strs []string) []int64 {
	var ret = make([]int64, 0, len(strs))
	for _, str := range strs {
		var intVal = s2i(str)
		ret = append(ret, intVal)
	}
	return ret
}

func intAry2strAry(nums []int64) []string {
	var ret = make([]string, 0, len(nums))
	for _, num := range nums {
		var strVal = i2s(num)
		ret = append(ret, strVal)
	}
	return ret
}

func ary2str(strs []string) string {
	return strings.Join(strs, " ")
}

func reverse(res []int64) []int64 {
	for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
		res[i], res[j] = res[j], res[i]
	}
	return res
}
func reverseStr(res []string) []string {
	for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
		res[i], res[j] = res[j], res[i]
	}
	return res
}

func ini(res []int, init int) {
	if len(res) == 0 {
		return
	}
	res[0] = init
	for i := 0; i < len(res); i++ {
		copy(res[i:], res[:i])
	}
}

//
// func regexpExample() {
//     // Your code here!
//     var str = "13:20"
//     r := regexp.MustCompile(`(\d+):(\d+)`)
//     fmt.Println(r.FindStringSubmatch(str))
// }

// type Country struct {
//     gold int
//     silver int
//     blonze int
// }

// // 複数ソートのサンプル
// func stableSortExample() []Country{
//     var country = []Country {
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:3, blonze:2},
//         {gold:1, silver:3, blonze:3},
//     }
//     sort.SliceStable(country, func(i, j int) bool { return country[i].blonze > country[j].blonze })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].silver > country[j].silver })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].gold > country[j].gold })
//     return country
// }


package main

import (
  "fmt"
)

func main() {
  var n int
  fmt.Scan(&n)
  p := make([]int, n)
  for i := 0; i < n; i++ {fmt.Scan(&p[i])}
  cnt := 0
  for i := 1; i < n - 1; i++ {
    if (p[i-1] < p[i] && p[i] < p[i+1]) ||
       (p[i-1] > p[i] && p[i] > p[i+1]) {
         cnt++
       }
  }
  fmt.Println(cnt)
}


package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	ps := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&ps[i])
	}

	p0 := ps[0]
	p1 := 0
	p2 := 0
	cnt1 := 0
	cnt2 := 0
	for i := 1; i < n-1; i++ {
		p1 = ps[i]
		p2 = ps[i+1]

		if p1 < p0 {
			cnt1++
		}

		if p1 < p2 {
			cnt1++
		}

		if cnt1 == 1 {
			cnt2++
			cnt1 = 0
		}

		p0 = ps[i]
	}

	fmt.Print(cnt2)
}


package main

import (
	"fmt"
	"unicode/utf8"
)

func main() {
	var N int
	fmt.Scan(&N)

	inputs := scanNums(N)

	fmt.Println(inputs)

	res := 0
	for i := 0; i < len(inputs)-2; i++ {
		a := inputs[i]
		b := inputs[i+1]
		c := inputs[i+2]

		if (a < b && b < c) || (c < b && b < a) {
			// fmt.Println(a, b, c)
			res++
		}
	}
	fmt.Println(res)

}

func scanStrings(len int) (strings []string) {
	var str string
	for i := 0; i < len; i++ {
		fmt.Scanf("%s", &str)
		strings = append(strings, str)
	}
	return
}

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func spritString(input string) (res []string) {
	for i := 0; i < utf8.RuneCountInString(input); i++ {
		res = append(res, input[i:i+1])
	}
	return
}


package main

import "fmt"

func main() {
	var sum int
	n := 9
	p := []int{9, 6, 3, 2, 5, 8, 7, 4, 1}

	for i := 1; i < n-1; i++ {
		p1 := p[i-1]
		p2 := p[i]
		p3 := p[i+1]
		if p1 < p2 && p2 < p3 || p1 > p2 && p2 > p3 {
			sum++
		}
	}

	fmt.Println(sum)
}


# https://atcoder.jp/contests/abc132/tasks/abc132_b

n = gets.to_i
ps = gets.split.map(&:to_i)
ans = ps.each_cons(3).count { |a, b, c| [a, b, c].sort[1] == b }
puts ans


n = gets.to_i
P = gets.split.map(&:to_i)

cnt = 0

(n-2).times do |i|
  if P[i,3].sort[1] == P[i+1]
    cnt += 1
  end
end

puts cnt


n = gets.to_i
p_a = gets.chomp.split
n.times do |i|
    p_a[i] = p_a[i].to_i
end

count = 0
(n-2).times do |i|
    if (p_a[i] <= p_a[i+1] && p_a[i+1] <= p_a[i+2]) || (p_a[i+2] <= p_a[i+1] && p_a[i+1] <= p_a[i])
        count += 1
    end
end

puts count


input = readlines()

n = input.shift.chomp.to_i
list = input.shift.chomp.split("\s").map{|x| x.to_i}

cnt = 0
list.each_with_index do |l, i|
  next if i < 2
  tmp = [list[i - 2], list[i - 1], list[i]]
  cnt += tmp.sort()[1] == list[i - 1]
end

puts cnt


n=gets.to_i
q=gets.split.map &:to_i
p (1..n-2).count{|i|(q[i-1]-q[i])*(q[i]-q[i+1])<0}


n=gets.to_i
q=gets.split.map &:to_i
p (1..n-2).count{|i|(q[i-1]-q[i])*(q[i]-q[i-1])<0}


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        v: [i32; n],
    }
    let mut ret = 0;
    for i in 1..(n-1) {
	if (v[i-1] < v[i] && v[i] < v[i+1]) || (v[i+1] < v[i] && v[i] < v[i-1]) {
	    ret += 1
	}
    }
    println!("{}", ret)
}


#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(d1: &Vec<i32>, d2: &Vec<i32>) -> bool {
    for i in 0..d1.len() {}

    return true;
}

use std::cmp;
use std::iter::Iterator;

fn main() {
    input! {
        n:usize,
         p:[i32;n]
    }

    let mut cnt = 0;
    for i in 0..n - 2 {
        if (p[i] > p[i + 1] && p[i + 1] > p[i + 2])
        || (p[i + 2] > p[i + 1] && p[i + 1] > p[i]) {
            cnt +=1
        }
    }
    println!("{}", cnt);
}


fn main() {
	use std::io::Read;
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: usize = s.next().unwrap().parse().unwrap();
	let p: Vec<i8> = s.map(|a| a.parse().unwrap()).collect();
	let ans = (1..n - 1).filter(|&i| (p[i - 1] < p[i] && p[i] < p[i + 1]) || (p[i - 1] > p[i] && p[i] > p[i + 1])).count();
	println!("{}", ans);
}


use std::cmp::Reverse;

fn main() {
    let n: u32 = read();
    let ps: Vec<u32> = read_vec();

    let mut counter = 0;
    for i in 1..(n - 1) as usize {
        let cp = vec![ps[i - 1], ps[i], ps[i + 1]];
        let mut acc = vec![ps[i - 1], ps[i], ps[i + 1]];
        let mut dec = vec!(ps[i-1], ps[i], ps[i+1]);
        acc.sort();
        dec.sort_by_key(|&num| Reverse(num));
        if  cp == acc || cp == dec{
            counter += 1;
        }
    }
    println!("{:?}", counter);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}


macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let n = get!(usize);
    let p = get!(usize ;;);

    let ans = (1..(n-1)).map(|i|
        if (p[i - 1] < p[i] && p[i] < p[i + 1]) || (p[i - 1] > p[i] && p[i] > p[i + 1]) {
            1
        } else {
            0
        }
    ).sum::<usize>();

    println!("{}", ans);
}


macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let n = get!(usize);
    let ps = get!(usize;;);
    let mut cnt = 0;
    for i in 1..(n-1) {
        if ps[i] > ps[i-1] && ps[i] > ps[i+1] {
            continue;
        }
        if ps[i] < ps[i-1] && ps[i] < ps[i+1] {
            continue;
        }
        cnt += 1;
    }
    println!("{}", cnt);
}


func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

let n:Int=Int(readLine()!)!
let per=readInts()
var ans=0;
for i in 0..<n-2{
  if((per[i]<per[i+1]&&per[i+1]<per[i+2])||(per[i]>per[i+1]&&per[i+1]>per[i+2])){ans+=1}
}

print(ans)


let n=Int(readLine()!)!
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let pp=readInts()
var count=0
for i in 1...(n-2){
  if (pp[i-1]<pp[i])&&(pp[i]<pp[i+1]){
    count+=1
  }else if (pp[i-1]>pp[i])&&(pp[i]>pp[i+1]){
    count+=1
  }
}

print(count)


let a=Int(readLine()!)!
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var i = 0
var count = 0

for i in 1..<a - 1 {
  if( ( arr[ i - 1 ] < arr[i] ) && ( arr[i] < arr[ i + 1 ] ) ) {
    count += 1
  } else if ( ( arr[ i - 1 ] > arr[i] ) && ( arr[i] > arr[ i + 1 ] ) ) {
    count += 1
  }
}

print( count )


import Foundation
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let nd=readInts()
let n=nd[0]
let d=nd[1]
var count=0
var xy:[[Int]]=[]
for _ in 1...n{
  let a=readInts()
  xy.append(a)
}
for i in 0...n-1{
  for j in 0...n-1{
    var distance=0
    for k in 0...n-1{
      distance+=(xy[i][k]-xy[j][k])*(xy[i][k]-xy[j][k])
    }
    if Double(sqrt(Double(distance)))-Double(Int(sqrt(Double(distance))))==0.0{
      count+=1
    }
  }
}
print(count)


let n=Int(readLine()!)!
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let pp=readInts()
var count=0
for i in 1...(n-1){
  if (pp[i-1]<pp[i])&&(pp[i]<pp[i+1]){
    count+=1
  }else if (pp[i-1]>pp[i])&&(pp[i]>pp[i+1]){
    count+=1
  }
}

print(count)


'use strict'
const main = (input: string) => {
    const std: string[] = input.split('\n');
    const n = Number(std.shift())
    const p = std.shift().split(' ').map(Number)
    let count = 0
    for (let i = 1; i < n-1; i++) {
        if (p[i-1] < p[i] && p[i] < p[i+1] || p[i-1] > p[i] && p[i] > p[i+1]) {
            count++
        }
    }
    console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim())


const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let n=t.n()
  let a=t.n(n)
  let ans=0
  for(let i=1;i<n-1;i++)if((a[i]>a[i-1]&&a[i]<a[i+1])||(a[i]<a[i-1]&&a[i]>a[i+1]))ans++
  t.o(ans)
}
main()


import { readFileSync } from 'fs'

function main(input: string) {
  const [N, ...list] = input.trim().split(/\s/).map(Number)

  const result = list
    .map((v, i, self) => [self[i - 1], v, self[i + 1]])
    .filter(([a, b, c]) => (a < b && b < c) || (a > b && b > c))

  console.log(result.length)
}

main(readFileSync('/dev/stdin', 'utf8').trim())


let input = '';
let count = 0;

process.stdin.on('data', (chunk: any) => {
  input += chunk;
  if (count === 1) {
    const args = normalize(input);
    main(args[0], args[1]);
  }
  count++;
});

function main(_: number, ps: number[]) {
  const matchedList = ps.filter((p, i, self) => {
    if (i === 0 || i === self.length - 1) return false;
    const sorted = [self[i - 1], p, self[i + 1]].sort((a, b) => a - b);
    return sorted[1] === p;
  });
  console.log(matchedList.length);
}

function normalize(input: any): [number, number[]] {
  const inputs = input.toString().split('\n');
  const n = Number(inputs[0]);
  const ps = inputs[1].split(' ').map((p: string) => Number(p));
  return [n, ps];
}


let input = '';
let count = 0;

process.stdin.on('data', (chunk: any) => {
  input += chunk;
  if (count === 1) {
    const args = normalize(input);
    main(args[0], args[1]);
    process.exit();
  }
  count++;
});

function main(_: number, ps: number[]) {
  const matchedList = ps.filter((p, i, self) => {
    if (i === 0 || i === self.length - 1) return false;
    const sorted = [self[i - 1], p, self[i + 1]].sort((a, b) => a - b);
    return sorted[1] === p;
  });
  console.log(matchedList.length);
}

function normalize(input: any): [number, number[]] {
  const inputs = input.toString().split('\n');
  const n = Number(inputs[0]);
  const ps = inputs[1].split(' ').map((p: string) => Number(p));
  return [n, ps];
}


process.stdin.resume();
process.stdin.setEncoding('utf8');
let input = '';
let count = 0;

process.stdin.on('data', (chunk: any) => {
  input += chunk;
  if (count === 1) {
    main(...normalize(input));
    process.exit();
  }
  count++;
});

function main(_: number, ps: number[]) {
  const matchedList = ps.filter((p, i, self) => {
    if (i === 0 || i === self.length - 1) return false;
    const sorted = [self[i - 1], p, self[i + 1]].sort((a, b) => a - b);
    return sorted[1] === p;
  });
  console.log(matchedList.length);
}

function normalize(input: any): [number, number[]] {
  const inputs = input.toString().split('\n');
  const n = Number(inputs[0]);
  const ps = inputs[1].split(' ').map((p: string) => Number(p));
  return [n, ps];
}


x,y=map(int,input().split())
result='No'
if x*4>=x:
    for i in range(x+1):
        if i*4+(x-i)*2==y:
            result='Yes'
            break
print(result)


x,y = map(int,input().split())
for i in range(x+1):
    t = y-2*i
    if t == 4*(x-i):
        print('Yes')
        exit()
print('No')


X,Y = list(map(int,input().split()))

x = 2.0*X - Y/2.0
y = Y/2.0 - X

if x >= 0 and y >= 0 and x == int(x) and y == int(y):
    print("Yes")
else:
    print("No")


x,y = map(int,input().split())
bool = False
for i in range(x+1):
    for j in range(x-i+1):
        if 2*i + 4*j == y:
            bool = True
if bool:
    print('Yes')
else:
    print('No')


x, y = map(int, input().split())
ans = 'No'
for i in range(x + 1):
    for j in range(x, -1, -1):
        if i * 2 + j * 4 == y:
            ans = 'Yes'
            break

print(ans)


x, y = map(int, input().split())
ans = 'No'
for i in range(1, x + 1):
    for j in range(x - i, -1, -1):
        if i * 2 + j * 4 == y or i * 2 == y or j * 4 == y:
            ans = 'Yes'
            break

print(ans)


import sun.rmi.runtime.Log;

import java.io. *;
import java.util.*;
import static java.lang.Math.*;
public class Main {

    static final FastReader sc = new FastReader(System.in);
    static final PrintWriter pw = new PrintWriter(System.out);

    static int visited[];
    static ArrayList<ArrayList<Integer>> adjlist;
    static class edge implements  Comparator<edge>{
        int dest;
        int cost;

        public edge(int dest, int cost) {
            this.dest = dest;
            this.cost = cost;
        }

        @Override
        public int compare(edge o1, edge o2) {
            return o1.cost-o2.cost;
        }
    }

    static int dist[];
    static int nodesinSubtree[];
    static int color[];
    static ArrayList<Integer> res1;
    static ArrayList<Integer> res2;

    static class Graph{
        int V;
        ArrayList<ArrayList<edge>> adj;
        PriorityQueue<edge> pq;

        public Graph(int V){
            this.V = V;
            adj = new ArrayList<>(V);
            pq = new PriorityQueue<>(V,new edge(-1,-1));
            dist = new int[V];
            nodesinSubtree = new int[V];
            color = new int[V];
            Arrays.fill(color,-1);
            for(int i=0; i<V; i++){
                dist[i] = Integer.MAX_VALUE;
                adj.add(i,new ArrayList<>());
            }
        }

        void addedge(int u, int v, int w ){
            adj.get(u).add(new edge(v,w));
            //adj.get(v).add(new edge(u,w));
        }

        void rDfs(int src, int e){
            //nodes in a subtree
            nodesinSubtree[src] = 1;
            for(int i=0; i<adj.get(src).size(); i++){
                if(adj.get(src).get(i).dest==e){
                    continue;
                }
                rDfs(adj.get(src).get(i).dest,src);
                nodesinSubtree[src]+=nodesinSubtree[adj.get(src).get(i).dest];
            }
        }

        void uBFS(int src){
            Queue<edge> q = new LinkedList<>();
            color = new int[V];
            q.add(new edge(src,0));
            color[src] = 0;
            while (!q.isEmpty()){
                int u = q.poll().dest;
                for(int i=0; i<adj.get(u).size(); i++){
                    if(color[adj.get(u).get(i).dest]==color[u]){
                        color[adj.get(u).get(i).dest] = color[u]+1;
                        q.add(new edge(adj.get(u).get(i).dest,0));
                    }
                }
            }
        }

        int DFS(int src){
            Stack<edge> st = new Stack<>();
            boolean visited[] = new boolean[V];
            visited[src] = true;
            st.push(new edge(src,0));
            dist[src] = 0;
            color[src] = 1;
            while (!st.empty()){
                int u = st.peek().dest;
                st.pop();
                for(int i=0; i<adj.get(u).size(); i++){
                    if(color[adj.get(u).get(i).dest]==0) {
                        if (color[u] == 0) {
                            color[adj.get(u).get(i).dest] = 1;
                        } else {
                            color[adj.get(u).get(i).dest] = 0;
                        }
                        st.push(new edge(adj.get(u).get(i).dest,0));
                    }else{
                        if(color[u]==0 && color[adj.get(u).get(i).dest]==0){
                            return -1;
                        }
                        if(color[u]==1 && color[adj.get(u).get(i).dest]==1){
                            return -1;
                        }
                    }
                }
            }
            return 0;
        }
    }

/*
        void dijkstra(int src){
            for(int i=0; i<V; i++){
                dist[i] = Integer.MAX_VALUE;
            }
            dist[src] = 0;
            pq.add(new edge(src,0));
            while (!pq.isEmpty()){
                int u = pq.poll().dest;
                for(int i=0; i<adj.get(u).size(); i++){
                    int v = adj.get(u).get(i).dest;
                    int w = adj.get(u).get(i).cost;
                    if(dist[u]+w<=dist[v]){
                        dist[v] = dist[u] + w;
                        pq.add(new edge(v,dist[v]));
                    }
                }
            }

        }

    }

 */

    static  int I[];
    static  int  L[];
    static void LIS(int n, int arr[]){
        I = new int[n+1];
        L = new int[n];
        I[0] = Integer.MIN_VALUE;
        for(int i=1;i<=n; i++){
            I[i] = Integer.MAX_VALUE;
        }
        int lisLength = 1;

        for(int i=n-1; i>=0; i--) {
            int low = 1;
            int high = lisLength;
            int mid = 0;
            while (low < high) {
                mid = (low + high) >> 1;
                if (I[mid] <= arr[i]) {
                    high = mid;
                } else {
                    low = mid + 1;
                }
            }
            I[high] = arr[i];
            L[i] = high;
            if(lisLength<=high){
                lisLength++;
            }
        }
    }

    public static long gcd(long a, long b)
    {
        if (a == 0)
            return b;

        return gcd(b%a, a);
    }

    public static long lcm(long a, long b)
    {
        return (a*b)/gcd(a, b);
    }

    static long nCr(long n, long r)
    {
        return fact(n) / (fact(r) * fact(n - r));
    }

    // Returns factorial of n
    static long fact(long n)
    {
        long res = 1;
        for (int i = 2; i <= n; i++)
            res = (res * i)%MOD;
        return res;
    }

    static int MOD = 1000000007;
    static int power(int x, int y, int p)
    {

        // Initialize result
        int res = 1;

        // Update x if it is more than or
        // equal to p
        x = x % p;

        while (y > 0)
        {

            // If y is odd, multiply x
            // with result
            if (y % 2 == 1)
                res = (res * x) % p;

            // y must be even now
            y = y >> 1; // y = y/2
            x = (x * x) % p;
        }

        return res;
    }

    // Returns n^(-1) mod p
    static int modInverse(int n, int p)
    {
        return power(n, p-2, p);
    }

    static int nCrModPFermat(int n, int r,
                             int p)
    {

        if (r == 0)
            return 1;

        int[] fac = new int[n+1];
        fac[0] = 1;

        for (int i = 1 ;i <= n; i++)
            fac[i] = fac[i-1] * i % p;

        return (fac[n]* modInverse(fac[r], p)
                % p * modInverse(fac[n-r], p)
                % p) % p;
    }

    static int[] phi;

    static void generatePhi(int n){
        phi = new int[n+1];

        for(int i = 0; i<=n; i++){
            phi[i] = i;
        }

        for(int i=2; i<=n; i++){
            if(phi[i]==i){
                for(int j= i; j<=n; j+=i){
                    phi[j] -= (phi[j]/i);
                }
            }
        }
    }

    static int gcdCount(int n, int d){
        return phi[n/d];
    }

    static boolean prime[];
    static int smallestFactor[];

    static void sieveOfEratosthenes(int n)
    {
        prime = new boolean[n+1];
        smallestFactor = new int[n+1];

        smallestFactor[1] = 1;
        for(int i=2;i<n;i++) {
            prime[i] = true;
            smallestFactor[i] = i;
        }

        for(int p = 2; p*p <=n; p++)
        {
            if(prime[p])
            {
                smallestFactor[p] = p;
                for(int i = p*p; i <= n; i += p) {
                    prime[i] = false;
                    smallestFactor[i] = min(p,smallestFactor[i]);
                }
            }
        }

    }

    static double Logx(double n, int x){
        return log(n)/log(x);
    }

    static boolean isPrime(long n){
        if(n<2){
            return false;
        }
        for(int i = 2; i*i<=n; i++){
            if(n%i==0){
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {

        int x = sc.nextInt();
        int y = sc.nextInt();

        if(y%2==0 && x>= ceil((double) y/4) && y>=2*x){
            pw.println("Yes");
        }else{
            pw.println("No");
        }

        pw.flush();

    }

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

    static class FastReader {
        InputStream is;
        private byte[] inbuf = new byte[1024];
        private int lenbuf = 0, ptrbuf = 0;

        public FastReader(InputStream is) {
            this.is = is;
        }

        public int readByte(){
            if(lenbuf == -1)throw new InputMismatchException();
            if(ptrbuf >= lenbuf){
                ptrbuf = 0;
                try {
                    lenbuf = is.read(inbuf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if(lenbuf <= 0)
                    return -1;
            }
            return inbuf[ptrbuf++];
        }
        public boolean isSpaceChar(int c) {
            return !(c >= 33 && c <= 126);
        }
        public int skip() {
            int b;
            while ((b = readByte()) != -1 && isSpaceChar(b)) ;
            return b;
        }
        public String next(){
            int b = skip();
            StringBuilder sb = new StringBuilder();
            while(!(isSpaceChar(b))) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public String nextLine(){
            int b = readByte();
            StringBuilder sb = new StringBuilder();
            while(b != '\n' || b != '\r'){
                sb.appendCodePoint(b);
            }
            return sb.toString();
        }
        public int nextInt() {
            int num = 0, b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            while (true) {
                if (b >= '0' && b <= '9') {
                    num = (num << 3) + (num << 1) + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }
        public long nextLong() {
            long num = 0;
            int b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            while (true) {
                if (b >= '0' && b <= '9') {
                    num = (num << 3) + (num << 1) + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }
        public char[] next(int n){
            char[] buf = new char[n];
            int b = skip(), p = 0;
            while (p < n && !(isSpaceChar(b))) {
                buf[p++] = (char) b;
                b = readByte();
            }
            return n == p ? buf : Arrays.copyOf(buf, p);
        }
        public char nextChar () {
            return (char) skip();
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

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);
		Solution sol = new Solution();
		sol.solve(in, out);
		out.close();
	}

	private static class Solution {
		private void solve(InputReader in, PrintWriter out) {
			int heads = in.ni(), legs = in.ni();
			if (legs % 2 != 0 || heads == 0 || heads > legs) out.println("No");
			else {
				int t = (legs + (-2*heads))/2;
				int c = heads - t;
				if (t < 0 || c < 0) {
					out.println("No");
					return;
				}
				out.println("Yes");
			}
		}
	}

	private static class InputReader {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		private InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		private String n() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

}


import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);

	 		StringTokenizer st = new StringTokenizer(bf.readLine());
	 		int a = Integer.parseInt(st.nextToken());
	 		int b = Integer.parseInt(st.nextToken());
	 		int d = b-2*a;
	 		if (d%2 == 1 || d <0)
	 		{

	 			out.println("No");
	 		}else{
	 			int t = d/2;
	 			if (a >= t){
	 				out.println("Yes");
	 			}
	 			else{
	 				out.println("No");
	 			}
	 		}

 		out.println();

 		out.close();

 	}
}

//StringJoiner sj = new StringJoiner(" ");
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is


 import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;

import javax.sound.sampled.ReverbType;

public class Main {

	 static Scanner scan=new Scanner(System.in);
	 static int cnt=0;
	 static int M=(int)1e9+7;
	static boolean issamedi(int i,int j){
		if(i>0&&j<0)
			return false;
		if(i>0&&j>0&&i>j)
			return false;
		return true;

	}

		static boolean isvowel(char c) {
			return c=='a'||c=='e'||c=='i'||c=='o'||c=='u';

		}
	 public static int maxVowels(String s, int k) {
	        int i=0;
	        ArrayList<Integer>lenghts=new ArrayList<Integer>();
	        for(int j=0;j<s.length();j++) {
	        	if(i==k)
	        		i=0;
	        	if(!isvowel(s.charAt(j)))
	        		i=0;
	        	if(isvowel(s.charAt(j))) {
	        		i++;
	        		lenghts.add(i);
	        		}

	        }
	        try {
	        return Collections.max(lenghts);
	        }
	        catch (NoSuchElementException e) {
	        return 0;}
	    }

	 static int convert(int n) {
		 String s=String.valueOf(n);
		 String s1="";
		 s1+=s.charAt(0);
		 int c=0;
		 for(int i=1;i<s.length();i++)
		 s1+='0';
		 return Integer.parseInt(s1);
	 }
	 static  boolean ispositive(ArrayList<Integer>ar) {
		 for(int i=0;i<ar.size();i++) {
			 if(ar.get(i)>0)
				 return true;
			 }
		 return false;

	 }
	public static void main(String[] args) throws IOException {
int x=scan.nextInt();
int y=scan.nextInt();

		for(int i=0;i<x+1;i++) {
			int a=x-i;
			if (2 * i + 3 * a == y) {
				System.out.println("Yes");
			return;
			}

		}
		System.out.println("No");

		}

}


 import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;

import javax.sound.sampled.ReverbType;

public class Main {

	 static Scanner scan=new Scanner(System.in);
	 static int cnt=0;
	 static int M=(int)1e9+7;
	static boolean issamedi(int i,int j){
		if(i>0&&j<0)
			return false;
		if(i>0&&j>0&&i>j)
			return false;
		return true;

	}

		static boolean isvowel(char c) {
			return c=='a'||c=='e'||c=='i'||c=='o'||c=='u';

		}
	 public static int maxVowels(String s, int k) {
	        int i=0;
	        ArrayList<Integer>lenghts=new ArrayList<Integer>();
	        for(int j=0;j<s.length();j++) {
	        	if(i==k)
	        		i=0;
	        	if(!isvowel(s.charAt(j)))
	        		i=0;
	        	if(isvowel(s.charAt(j))) {
	        		i++;
	        		lenghts.add(i);
	        		}

	        }
	        try {
	        return Collections.max(lenghts);
	        }
	        catch (NoSuchElementException e) {
	        return 0;}
	    }

	 static int convert(int n) {
		 String s=String.valueOf(n);
		 String s1="";
		 s1+=s.charAt(0);
		 int c=0;
		 for(int i=1;i<s.length();i++)
		 s1+='0';
		 return Integer.parseInt(s1);
	 }
	 static  boolean ispositive(ArrayList<Integer>ar) {
		 for(int i=0;i<ar.size();i++) {
			 if(ar.get(i)>0)
				 return true;
			 }
		 return false;

	 }
	public static void main(String[] args) throws IOException {
int x=scan.nextInt();
int y=scan.nextInt();

		if(x%2==1&&y%2==0)
			System.out.println("Yes");
	//	else if(x%2==0&&y%2==0)
		//	System.out.println("No");
		else {
			int div=y/x;
			int temp=y%x;
			div=div*2;
			y=y-div;
			if(temp*3==y)
				System.out.println("Yes");
			else
			System.out.println("No");

		}

 }

}


#include <cstdio>

int main(void){
	int X,Y;
	scanf("%d %d",&X,&Y);
	puts(Y>=2*X&&Y<=4*X&&Y%2==0?"Yes":"No");
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
    long long int i, j, k, n, a, b, ans=0, po=0, x, y;
    char name[30];
    scanf("%lld %lld", &x, &y);
    if(y%2 != 0) printf("No");
    else if(2*x <= y && y <= 4*x) printf("Yes");
    else printf("No");

}


#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int h,t;
    scanf("%d%d",&h,&t);
    int cha=h*4-t;
    if(cha%2==0&&(0<=cha/2&&cha/2<=h)) puts("Yes");
    else puts("No");
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
  int x, y;
  cin >> x >> y;

  bool flag = false;
  for(int i=0; i<=x; i++){
    for(int j=0; j<=x-i; j++){
      if(2*i + 4*j == y)
        flag = true;
    }
  }

  if(flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


//shara's here
//speeeeeeeeeed is keeeeeeeeeey
//reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaadddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
#include <bits/stdc++.h>
using namespace std;
typedef string s;
typedef long long ll;
typedef long double ld;
const ll inf = 1e18 + 10;
const ll minf = -(1e18 + 10);
const ll mod = 1e9 + 7;
#if !defined(ONLINE_JUDGE)
#include "debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define pb push_back
#define all(x) x.begin(),x.end()
#define vl vector<ll>
#define vll vector<vector<ll> >
#define ins insert
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int main(){
    speed
    ll x , y;
    cin >> x >> y;
    debug(x,y);
    while(x>0){
    if(x-4>=0)x-=4;
    else if(x-2>=0)x-=2;
    else break;
    }
    puts(x==0?"No":"Yes");

return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


//shara's here
//speeeeeeeeeed is keeeeeeeeeey
//reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaadddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
#include <bits/stdc++.h>
using namespace std;
typedef string s;
typedef long long ll;
typedef long double ld;
const ll inf = 1e18 + 10;
const ll minf = -(1e18 + 10);
const ll mod = 1e9 + 7;
#if !defined(online_judge)
#include "debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define pb push_back
#define all(x) x.begin(),x.end()
#define vl vector<ll>
#define vll vector<vector<ll> >
#define ins insert
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int main(){
    speed
    ll x , y;
    cin >> x >> y;
    debug(x,y);
    while(x>0){
    if(x-4>=0)x-=4;
    else if(x-2>=0)x-=2;
    else break;
    }
    puts(x==0?"No":"Yes");

return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5
#define PI 3.141592653589793238

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
void cin(ll *n){ scanf("%lld",&(*n)); }
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
double POW_d(double a, double b){double c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
ll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}
ll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }

void lr_lower( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am < val ?  ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }
void lr_upper( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am <= val ?  ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }
int cmp_lower( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a>=b ? 1 : 0 ) : ( a>b ? 1 : 0 ) ; }
int cmp_upper( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a<=b ? 1 : 0 ) : ( a<b ? 1 : 0 ) ; }
// return smallest p  which meets  a[p]==val :1  >=:2   >:3
ll lower_bound( ll a[], int l, int r, ll val , int type ){  while(r-l>1) lr_lower(&l,&r,a[ (l+r)/2 ],val,type);  return cmp_lower(a[l],val,type) ? l : cmp_lower(a[r],val,type) ? r : -1;  }
// return biggest p  which meets   a[p]==val :1  <=:2   <:3
ll upper_bound( ll a[], int l, int r, ll val , int type ){  while(r-l>1) lr_upper(&l,&r,a[ (l+r)/2 ],val,type); return cmp_upper(a[r],val,type) ? r : cmp_upper(a[l],val,type) ? l : -1; }
// count i  which meets ai==x
ll count(ll a[], int l, int r, ll x){  int p = lower_bound(a,l,r,x,1);  return p==-1 ? 0 : upper_bound(a,p,r,x,1)-p+1; }

ll *factors[2] , fac_cnt=0 , is_factor_prepared=0;
ll factor_pre(){  rep(i,0,1){ if(is_factor_prepared++) return 0; }  ll tmp=(1e6)/2+1, fac_tmp[tmp];  rep(i,0,tmp){fac_tmp[i]=i?2*i+1:2;}  rep(i,1,tmp){if(fac_tmp[i]){  repp(j,3,tmp/(2*i+1)+1,2 ){  if( j*(2*i+1)<tmp ) fac_tmp[ (j*(2*i+1)-1)/2 ]=0;  }  }else continue;}  rep(i,0,tmp){if(fac_tmp[i]){  rep(j,0,2){ factors[j] = realloc( factors[j] , sizeof(ll)*( fac_cnt +1 ) );  factors[j][j?fac_cnt++:fac_cnt]=j?0:fac_tmp[i];  }  } }  return 0;  }
ll factor(ll n, ll new_common_plus){ factor_pre();  rep(i,0,fac_cnt){ ll cnt=0; rep(j,0,1){ while( ( cnt+= n %factors[0][i]==0 ? 1 : 0 )  && (n/=factors[0][i]) %factors[0][i]==0 ) continue; } factors[1][i]= new_common_plus==1 ? cnt :  new_common_plus==2 ? max2(factors[1][i],cnt) : factors[1][i]+cnt ;  if( factors[0][i]> n ) break; } return n; }
ll judge_prime(ll n){ factor_pre(); rep(i,0,fac_cnt){ if(n<factors[0][i]*factors[0][i] || n==factors[0][i]) break; else if(n%factors[0][i]==0) n/=n; }  return n==1?0:1; }

ll *mod_fac_arr,*inv_arr,*finv_arr,is_modinv_made=0,is_modfac_made=0;
ll makeinv(ll n , ll mod){  rep(i,0,1){if(is_modinv_made++) return 0;}  inv_arr = realloc(inv_arr, sizeof(ll)*2 );  finv_arr = realloc(finv_arr, sizeof(ll)*2 );  inv_arr[1]=1;finv_arr[0]=finv_arr[1]=1;  rep(i,2,n+1){  inv_arr = realloc(inv_arr, sizeof(ll)*(i+1) );  finv_arr = realloc(finv_arr, sizeof(ll)*(i+1) );  inv_arr[i]= mod - inv_arr[mod%i] * (mod / i) % mod;  finv_arr[i] = finv_arr[i - 1] * inv_arr[i] % mod;  }  return 0; }
ll make_mod_fac(ll n, ll mod){  rep(i,0,1){ if(is_modfac_made++) return 0; }  mod_fac_arr = realloc(mod_fac_arr, sizeof(ll)*2 );  ll x=1;  mod_fac_arr[0]=mod_fac_arr[1]=x;  rep(i,2,n+1){   x=x*i%mod;  mod_fac_arr = realloc(mod_fac_arr, sizeof(ll)*(i+1) );  mod_fac_arr[i]=x; }  return 0;  }
ll mod_inv(ll x, ll mod, ll is_fac ){ makeinv(2*1e5,mod);  return is_fac?finv_arr[x]:inv_arr[x]; }
ll mod_fac(ll x, ll mod){  make_mod_fac(2*1e5,mod);  return mod_fac_arr[x];  }
// ll mod_nck(ll n, ll k, ll mod){ return mod_fac[n]*finv_arr[k]%mod*finv_arr[n-k]%mod; }
ll modpow(ll r,ll n,ll mod){  ll t=1,s=r;  while(n>0){ t = (n&1) ? t*s%mod : t;  s=s*s%mod; n>>=1; }  return r?t:0;  }

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
int cmp_string( const void * a , const void * b ) {  return strcmp( (char *)a , (char *)b ); }  // qsort((void*)s,n,sizeof(s[0]),int_sort );
int cmp_char(const void * a, const void * b) { return *(char *)a - *(char *)b;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
void sort_string(int n,int size,char s[][size]){ qsort( (void*)s , n , sizeof(s[0]) , cmp_string ); }
void sort_char(char *s){ qsort( (void *)s , strlen(s) , sizeof(char) , cmp_char ); }
ll unique_string(ll n ,ll size, char s[][size]){ ll ans=1; rep(i,1,n) if( strcmp(s[i],s[i-1]) ) ans++; return ans; }
ll unique_num(ll n , ll a[]){ ll ans=1; rep(i,1,n) if( a[i]!=a[i-1] ) ans++; return ans; }

typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}

int main(void){
    // fgets(s,sizeof(s),stdin);
    // char ;
    ll x,y;
    // ll ans=0;
    cin(&x);
    cin(&y);
    // scanf("%s",);
    // ll [n];
    rep(i,0,x+1){
        if(i*2+(x-i)*4 == y ){
            YES;
            return 0;
        }
    }

    // printf("%lld\n");
    NO;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <limits.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
#define SWAP(type, a, b) { const type tmp = a; a = b; b = tmp; }

int compare_sz_asc(const void* a, const void* b) {
    return *((size_t*)a) < *((size_t*)b) ? -1 : 1;
}

int compare_sz_desc(const void* a, const void* b) {
    return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_i64_asc(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_i64_desc(const void* a, const void* b) {
    return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1;
}

int compare_u64_asc(const void* a, const void* b) {
    return *((uint64_t*)a) < *((uint64_t*)b) ? -1 : 1;
}

int compare_u64_desc(const void* a, const void* b) {
    return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}

int compare_c_asc(const void* a, const void* b) {
    return *((char*)a) < *((char*)b) ? -1 : 1;
}

int compare_c_desc(const void* a, const void* b) {
    return *((char*)a) > * ((char*)b) ? -1 : 1;
}

int compare_dp_asc(const void* a, const void* b) {
    return *((double*)a) < *((double*)b) ? -1 : 1;
}

static uint64_t modinvU64(const uint64_t a, const uint64_t m) {
    int64_t aa = (int64_t)a;
    const int64_t mm = (int64_t)m;
    int64_t b = mm;
    int64_t u = 1;
    int64_t v = 0;

    while (b != 0) {
        const int64_t t = aa / b;

        aa -= t * b;
        SWAP(uint64_t, aa, b);
        u -= t * v;
        SWAP(uint64_t, u, v);
    }

    u %= mm;
    if (u < 0) {
        u += m;
    }

    return (uint64_t)u;
}

static size_t powSz(const size_t base, const size_t exp) {
    if (exp == 0) {
        return 1;
    }

    if (exp == 1) {
        return base;
    }

    if (exp % 2 == 0) {
        return powSz(base * base, exp / 2);
    }
    else {
        return base * powSz(base, exp - 1);
    }
}

static uint64_t powU64(const uint64_t base, const uint64_t exp) {
    if (exp == 0) {
        return 1;
    }

    if (exp == 1) {
        return base;
    }

    if (exp % 2 == 0) {
        return powU64(base * base, exp / 2);
    }
    else {
        return base * powU64(base, exp - 1);
    }
}

static uint64_t powU64WMod(const uint64_t base, const uint64_t exp, const uint64_t m) {
    if (exp == 0) {
        return 1;
    }

    if (exp == 1) {
        return base % m;
    }

    if (exp % 2 == 0) {
        return powU64WMod(base * base % m, exp / 2, m);
    }
    else {
        return base * powU64WMod(base, exp - 1, m) % m;
    }
}

static size_t combSz(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64WMod(const uint64_t n, const uint64_t r, const uint64_t m) {
    uint64_t result = 1;
    uint64_t inv = 1;

    for (uint64_t i = 0; i < r; i++) {
        result = result * (n - i) % m;
        inv = inv * (i + 1) % m;
    }

    return result * modinvU64(inv, m) % m;
}

static uint64_t permU64(const uint64_t n) {
    uint64_t result = 1;

    for (uint64_t v = 2; v <= n; v++) {
        result *= v;
    }

    return result;
}

static uint64_t permU64WMod(const uint64_t n, const uint64_t m) {
    uint64_t result = 1;

    for (uint64_t v = 2; v <= n; v++) {
        result *= v;
        result %= m;
    }

    return result;
}

static size_t gcdZu(size_t m, size_t n) {
    size_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static uint64_t gcdU64(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static uint64_t popcntU64(uint64_t val) {
    uint64_t cnt = 0;

    while (val != 0) {
        if ((val & UINT64_C(0x1)) != 0) {
            cnt++;
        }

        val >>= UINT64_C(0x1);
    }

    return cnt;
}

typedef struct {
    uint64_t val;
}BHeap_Val;

#define BHEAP_VAL_TYPE BHeap_Val

#define BHEAP_INVALID_NODE ((size_t)100000000)

typedef struct {
    BHEAP_VAL_TYPE val;
} BHeap_Node;

struct _BHeap_Ctx {
    size_t size;
    int (*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node);
    void(*notifyNodeChange)(const struct _BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList);
    BHeap_Node* node;
};

typedef struct _BHeap_Ctx BHeap_Ctx;

static void bHeap_Init(BHeap_Ctx* const ctx, int(*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node), void(*notifyNodeChange)(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList), BHeap_Node* const nodes) {
    ctx->size = 0;
    ctx->compare = compare;
    ctx->notifyNodeChange = notifyNodeChange;
    ctx->node = nodes;
}

static void bHeap_Swap(BHeap_Ctx* const ctx, const size_t node0, const size_t node1) {
    const BHEAP_VAL_TYPE tmp = ctx->node[node0].val;
    ctx->node[node0].val = ctx->node[node1].val;
    ctx->node[node1].val = tmp;

    if (ctx->notifyNodeChange != NULL) {
        const size_t nodeList[2] = { node0,node1 };
        ctx->notifyNodeChange(ctx, 2, nodeList);
    }
}

static void bHeap_UpHeap(BHeap_Ctx* const ctx, const size_t nodeIdx) {
    if (nodeIdx == 0) {
        return;
    }

    const size_t parentIdx = (nodeIdx + 1) / 2 - 1;

    const int compareResult = ctx->compare(&(ctx->node[parentIdx].val), &(ctx->node[nodeIdx].val));

    if (0 < compareResult) {
        bHeap_Swap(ctx, nodeIdx, parentIdx);

        if (parentIdx != 0) {
            bHeap_UpHeap(ctx, parentIdx);
        }
    }
}

static void bHeap_DownHeap(BHeap_Ctx* const ctx, const size_t nodeIdx) {
    if (ctx->size - 1 <= nodeIdx) {
        return;
    }

    const size_t leftIdx = 2 * (nodeIdx + 1) - 1;

    if (leftIdx < ctx->size) {
        const int leftResult = ctx->compare(&(ctx->node[nodeIdx].val), &(ctx->node[leftIdx].val));

        size_t swapTarget = leftResult < 0 ? BHEAP_INVALID_NODE : leftIdx;

        const size_t rightIdx = leftIdx + 1;

        if (rightIdx < ctx->size) {
            const int rightResult = ctx->compare(&(ctx->node[nodeIdx].val), &(ctx->node[rightIdx].val));

            if (swapTarget == BHEAP_INVALID_NODE) {
                if (0 < rightResult) {
                    swapTarget = rightIdx;
                }
            }
            else {
                if (0 < rightResult) {
                    const int rightLeftResult = ctx->compare(&(ctx->node[leftIdx].val), &(ctx->node[rightIdx].val));

                    if (0 < rightLeftResult) {
                        swapTarget = rightIdx;
                    }
                }
            }
        }

        if (swapTarget != BHEAP_INVALID_NODE) {
            bHeap_Swap(ctx, nodeIdx, swapTarget);

            bHeap_DownHeap(ctx, swapTarget);
        }
    }
}

static void bHeap_Add(BHeap_Ctx* const ctx, const BHEAP_VAL_TYPE val) {
    ctx->node[ctx->size].val = val;

    ctx->size++;

    if (ctx->notifyNodeChange != NULL) {
        const size_t node = ctx->size - 1;
        ctx->notifyNodeChange(ctx, 1, &node);
    }

    bHeap_UpHeap(ctx, ctx->size - 1);
}

static void bHeap_RemoveTop(BHeap_Ctx* const ctx) {
    if (ctx->size == 0) {
        return;
    }

    if (ctx->size == 1) {
        ctx->size--;
        return;
    }

    ctx->node[0].val = ctx->node[ctx->size - 1].val;

    if (ctx->notifyNodeChange != NULL) {
        const size_t node = 0;
        ctx->notifyNodeChange(ctx, 1, &node);
    }

    ctx->size--;

    bHeap_DownHeap(ctx, 0);
}

static void bHeap_RemoveNode(BHeap_Ctx* const ctx, const size_t node) {
    if (node == ctx->size - 1) {
        ctx->size--;
    }
    else {
        ctx->node[node].val = ctx->node[ctx->size - 1].val;

        ctx->size--;

        if (ctx->notifyNodeChange != NULL) {
            ctx->notifyNodeChange(ctx, 1, &node);
        }

        bHeap_DownHeap(ctx, node);
        bHeap_UpHeap(ctx, node);
    }
}

static BHEAP_VAL_TYPE* bHeap_GetTopVal(const BHeap_Ctx* const ctx) {
    return ctx->size == 0 ? NULL : &(ctx->node[0].val);
}

typedef struct {
    uint64_t cnt;
    size_t* child;
    size_t numChild;
    size_t maxNumChild;
} Tree_Node;

#define TREE_INIT_ALLOC (128)

static Tree_Node tree_Node[200000];

static void tree_Init(const uint64_t N) {
    for (uint64_t i = 0; i < N; i++) {
        tree_Node[i].cnt = 0;
        tree_Node[i].numChild = 0;
        tree_Node[i].child = malloc(sizeof(size_t) * TREE_INIT_ALLOC);
        tree_Node[i].maxNumChild = TREE_INIT_ALLOC;
    }
}

static void tree_AddChild(const size_t parent, const size_t child) {
    if (tree_Node[parent].maxNumChild <= tree_Node[parent].numChild) {
        tree_Node[parent].child = realloc(tree_Node[parent].child, sizeof(size_t) * tree_Node[parent].maxNumChild * 2);
        tree_Node[parent].maxNumChild *= 2;
    }

    tree_Node[parent].child[tree_Node[parent].numChild] = child;
    tree_Node[parent].numChild++;
}

static BHeap_Node BN_Asc[200000];
static BHeap_Node BN_Desc[200000];

static int _bHeap_Compare_Asc(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) {
    return parent->val <= node->val ? -1 : 1;
}

static int _bHeap_Compare_Desc(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) {
    return parent->val >= node->val ? -1 : 1;
}

static size_t PBHeap_Asc_Idx[200000];
static size_t PBHeap_Desc_Idx[200000];

static void _bHeap_NotifyNodeChange_Asc(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList) {
    for (size_t i = 0; i < nodeListSize; i++) {
        PBHeap_Asc_Idx[ctx->node[nodeList[i]].val.val] = nodeList[i];
    }
}

static void _bHeap_NotifyNodeChange_Desc(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList) {
    for (size_t i = 0; i < nodeListSize; i++) {
        PBHeap_Desc_Idx[ctx->node[nodeList[i]].val.val] = nodeList[i];
    }
}

#define UF_ROOT ((size_t)10000000)

typedef struct {
    size_t parent;
    uint64_t w;
    uint64_t v;
    uint64_t wSum;
    uint64_t vSum;
} UF_Node;

static UF_Node uf_Node[101];

static size_t uf_GetRoot(const size_t idx) {
    if (uf_Node[idx].parent == UF_ROOT) {
        return idx;
    }

    const size_t root = uf_GetRoot(uf_Node[idx].parent);

    uf_Node[idx].parent = root;

    return root;
}

static void uf_Merge(const size_t a, const size_t b) {
    const size_t aRoot = uf_GetRoot(a);
    const size_t bRoot = uf_GetRoot(b);

    if (aRoot != bRoot) {
        uf_Node[aRoot].parent = bRoot;

        uf_Node[bRoot].wSum += uf_Node[aRoot].wSum;
        uf_Node[bRoot].vSum += uf_Node[aRoot].vSum;
    }
}

static void sha1(const char* str, uint64_t len, uint32_t* hash) {
    if (len == 0) {
        len = (uint64_t)strlen(str);
    }

    uint32_t h[5] = { 0x67452301 ,0xEFCDAB89 ,0x98BADCFE ,0x10325476 ,0xC3D2E1F0 };

    uint32_t w[80];
    for (uint64_t i = 0; i < 16; i++) {
        w[i] = 0;
    }
    for (uint64_t i = 0; i < len; i++) {
        w[i / 4] |= (uint32_t)(str[i]) << ((i % 4) * 8);
    }
    w[15] = (uint32_t)len * 8;

    for (uint64_t i = 16; i < 80; i++) {
        const uint32_t v = w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16];
        w[i] = (v << 1) | (v >> 31);
    }

    uint32_t a = h[0];
    uint32_t b = h[1];
    uint32_t c = h[2];
    uint32_t d = h[3];
    uint32_t e = h[4];

    for (uint64_t i = 0; i < 80; i++) {
        uint32_t f = 0;
        uint32_t k = 0;
        if (i < 20) {
            f = (a & b) | (~b & d);
            k = 0x5A827999;
        }
        else if (i < 40) {
            f = b ^ c ^ d;
            k = 0x6ED9EBA1;
        }
        else if (i < 60) {
            f = (b & c) | (b & d) | (c & d);
            k = 0x8F1BBCDC;
        }
        else {
            f = b ^ c ^ d;
            k = 0xCA62C1D6;
        }

        const uint32_t t = ((a << 5) | (a >> 27)) + f + e + k + w[i];
        e = d;
        d = c;
        c = (b << 30) | (b >> 2);
        b = a;
        a = t;
    }

    h[0] = h[0] + a;
    h[1] = h[1] + b;
    h[2] = h[2] + c;
    h[3] = h[3] + d;
    h[4] = h[4] + e;

    hash[4] = h[0];
    hash[3] = h[1];
    hash[2] = h[2];
    hash[1] = h[3];
    hash[0] = h[4];
}

#define MOD_VAL (UINT64_C(1000000007))

typedef struct {
    uint64_t strListSize;
    char str[10][11];
} HMap;

static HMap hMap[1000000];

int main(void) {
    uint64_t X, Y;

    scanf("%"PRIu64"%"PRIu64, &X, &Y);

    for (uint64_t a = 0; a <= X; a++) {
        if (2 * a + 4 * (X - a) == Y) {
            puts("Yes");

            return 0;
        }
    }
    puts("No");
    return 0;
}


#include <stdio.h>

int main() {
	int X, Y;
	scanf("%d%d", &X, &Y);
	if (Y % 2 != 0) {
		printf("No\n");
	} else if (Y < 2 * X || 4 * X < Y) {
		printf("No\n");
	} else {
		printf("Yes\n");
	}
	return 0;
}


#include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)

int main()
{
    int X, Y;

    scanf("%d %d", &X, &Y);

    for (int i = 1; i <= X; i++) {
        if (Y == 2 * i + (X - i) * 4) {
            printf("Yes");
            return 0;
        }
    }
    printf("No");

    return 0;
}


#include<stdio.h>

int main(void) {
	int x, y;
	scanf("%d %d", &x, &y);
	int i, n;
	for (i = 0; i <= x; i++) {
		n = 2 * i + 4 * (x - 1);
			if (n == y) {
				printf("Yes");
			}
			else {
				printf("No");
			}
			break;
	}
	return 0;

}


#include<stdio.h>

int main(void){
  int X,Y,i;
  scanf("%d %d",X,Y);
  for(i=0;i<=X;i++){
    if((2*i+4*(X-i))==Y){
      printf("Yes\n");
      return 0;
      }
  }
  printf("No\n");
  return 0;

}


"use strict"
function main(arg) {
    let [X,Y] = arg.trim().split("\n")[0].split(" ").map(Number)
    for (let i = 0; i <= X; i++) {
        let a = i * 2 + (X-i) * 4
        if (a === Y) {
            console.log('Yes')
            return
        }
    }
    console.log('No')
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


function Main(input) {
    input = input.split(" ");
  	const total = parseInt(input[0]);
  	const foot = parseInt(input[1]);
  	let bool = false;
  	for(let i=0; i<=total; i++){
    	if(4*i+2*(total-i) == foot){
        	console.log("Yes");
          	bool=true;
          	break;
        }
    }
  if(!bool){
  	console.log("No");
  }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {

	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");

    let x = parseInt(input[0].split(" ")[0]);
    let y = parseInt(input[0].split(" ")[1]);

    let flag = false;

    for (let i = 0; i <= x; i++){

        if (i * 2 + (x - i) * 4 == y) flag = true;

    }

    if (flag) console.log("Yes");
    else console.log("No");

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


const main = (input) => {
  const [x, y] = input.trim().split(' ').map(Number)

  const turtle = Math.max((y-2*x) / 2, 0)
  const crane = Math.max(x - turtle, 0)

  return console.log((turtle + crane === x) && (turtle*4 + crane*2 === y) ? 'Yes' : 'No')
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))


const main = (input) => {
  const [x, y] = input.trim().split(' ').map(Number)

  const turtle = (y-2*x) / 2
  const crane = Math.max(x - turtle, 0)

  return console.log((turtle + crane === x) && (turtle*4 + crane*2 === y) ? 'Yes' : 'No')
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))


function Main(input) {
  input = input.split("\n");
  const X = parseInt(input[0].split(" ")[0]);
  const Y = parseInt(input[0].split(" ")[1]);

  if ((Y - X * 2) % 2 === 0 && X * 4 <= Y && X * 2 <=Y) {
    console.log("Yes");
  } else {
    console.log("No");
  }
}

// デバッグ用
function debug() {
  var input = document.getElementById("input").value;
  Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


package main

import "fmt"

func main() {
	var x, y int
	fmt.Scan(&x, &y)
	if y%2 == 1 {
		fmt.Println("No")
		return
	}
	ansx := 2*x - (y / 2)
	ansy := y/2 - x
	if ansx < 0 || ansy < 0 {
		fmt.Println("No")
		return
	}
	fmt.Println("Yes")
	return
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func scanInts64(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		res[i] = scanInt64()
	}
	return res
}

func scanText() string {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Scan()
	return sc.Text()
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	x, y := scanInt(), scanInt()
	if 2*x <= y && y <= 4*x && y%2 == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	a := nextInt()
	turu := 0

	for turu = 0; turu <= n; turu++ {

		if turu*2+(n-turu)*4 == a {
			fmt.Println("Yes")
			return
		}
	}

	fmt.Println("No")
}

// ---- readfunc
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


package main

import "fmt"

func main() {
	var X, Y int
	ans := "No"

	fmt.Scan(&X, &Y)

	for i := 0; i <= X; i++ {
		for j := 0; j <= X - i; j++ {
			if (2 * i + 4 * j == Y) {
				ans = "Yes"
			}
		}
	}

	fmt.Println(ans)
}


package main

import "fmt"

func main() {
	var X, Y int
	ans := "No"

	fmt.Scan(&X, &Y)

	for i := 0; i =< X; i++ {
		for j := 0; j =< X - i; j++ {
			if (2 * i + 4 * j == Y) {
				ans = "Yes"
			}
		}
	}

	fmt.Println(ans)
}


package main

import "fmt"

func main() {
	var X, Y int
	ans := "No"

	fmt.Scan(&X, &Y)

	for i := 0; i < X; i++ {
		for j := 0; j < X - i; j++ {
			if (2 * i + 4 * j == Y) {
				ans = "Yes"
			}
		}
	}

	fmt.Println(ans)
}


X, Y = ARGF.gets.chomp.split.collect {|el| el.to_i}

ans = "No"
for tt in 0..X
  kk = X - tt
  if tt * 2 + kk * 4 == Y
    ans = "Yes"
    #p tt, kk
    break
  end
end

puts ans


io = STDIN
xy=io.gets.split.map(&:to_i)
hash={}
51.times do |t|
  26.times do |k|
    hash[[t+k,t*2+k*4]]=true
  end
end
if hash[xy]
  puts 'Yes'
else
  puts 'No'
end


a, b = gets.split.map(&:to_i)

(0..a).each do |i|
  if b == (i*2) + (a - i)*4
    puts "Yes"
  	exit
  end
end

puts "No"


x,y = gets.chomp.split(" ").map(&:to_i)
puts "No" if y % 2 != 0
puts x >= (y/4).to_f ? "Yes" : "No"


x,y = gets.chomp.split(" ").map(&:to_i)
puts x >= (y/4).to_f ? "Yes" : "No"


x,y = gets.split(" ").map(&:to_i)
res = 0
(0..x).each do |i|
  if (4*i + 2*(x-i)) == y
    res = "Yes"
  end
end

if res == "Yes"
  p res
else
  p "No"
end


use proconio;

#[proconio::fastout]
fn main() {
    proconio::input! {
        x: usize,
        y: usize,
    }

    let result = (0..=x).map(|i| 2 * i + 4 * (x - i)).any(|v| v == y);
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let x: usize = read();
    let y: usize = read();
    if x * 2 > y || y > x * 4 || y %2 == 1{
        println!("No");
    } else {
        println!("Yes");
    }
}


#[allow(unused_imports)]
use std::cmp::max;
#[allow(unused_imports)]
use std::cmp::min;
#[allow(unused_imports)]
use std::fmt;
#[allow(unused_imports)]
use std::fmt::Debug;
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
    let input = get_vec_input();
    let x: usize = input[0];
    let y: usize = input[1];

    if (y - 2 * x) % 2 == 0 && (y - 2 * x) / 2 <= x {
        println!("Yes");
    } else {
        println!("No");
    }
}

#[allow(dead_code)]
fn get_digit(value: i64) -> i64 {
    let mut digit = 0i64;
    let mut value = value;
    while value != 0 {
        value /= 10;
        digit += 1;
    }
    digit
}

#[allow(dead_code)]
fn sum_digit2(value: String) -> u32 {
    return value.chars().fold(0u32, |a, b| a + b.to_digit(10).unwrap());
}

#[allow(dead_code)]
fn sum_digit(value: i64) -> i64 {
    if value < 10 {
        return value;
    }
    return sum_digit(value / 10) + value % 10;
}

#[allow(dead_code)]
fn update_max<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left < right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn update_min<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left > right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn get_vec_input<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let vec: Vec<T> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    vec
}

#[allow(dead_code)]
fn get_tuple_input() -> (u64, f32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    let c: u64 = iter.next().unwrap().parse().unwrap();
    let n: f32 = iter.next().unwrap().parse().unwrap();
    (c, n)
}

#[allow(dead_code)]
fn get_string_input() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    s.trim().to_string()
}


#![allow(unused_imports, unused_macros)]

use kyoproio::*;
use std::{
    collections::*,
    io::{self, prelude::*},
    iter,
    mem::{replace, swap},
};

fn main() -> io::Result<()> {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024)
        .spawn(|| {
            let stdin = io::stdin();
            let stdout = io::stdout();
            run(KInput::new(stdin.lock()), io::BufWriter::new(stdout.lock()))
        })?
        .join()
        .unwrap();
    Ok(())
}

fn run<I: Input, O: Write>(mut kin: I, mut out: O) {
    macro_rules! output { ($($args:expr),+) => { write!(&mut out, $($args),+).unwrap(); }; }
    macro_rules! outputln {
        ($($args:expr),+) => { output!($($args),+); outputln!(); };
        () => { output!("\n"); if cfg!(debug_assertions) { out.flush().unwrap(); } }
    }

    let (x, y): (i32, i32) = kin.input();
    let ans = 2 * y <= x && x <= 4 * y && y % 2 == 0;
    outputln!("{}", ["No", "Yes"][ans as usize]);
}

// -----------------------------------------------------------------------------
pub mod kyoproio {
    use std::io::prelude::*;
    pub trait Input {
        fn str(&mut self) -> &str;
        fn input<T: InputParse>(&mut self) -> T {
            T::input(self)
        }
        fn iter<T: InputParse>(&mut self) -> Iter<T, Self> {
            Iter(self, std::marker::PhantomData)
        }
        fn seq<T: InputParse, B: std::iter::FromIterator<T>>(&mut self, n: usize) -> B {
            self.iter().take(n).collect()
        }
    }
    pub struct KInput<R> {
        src: R,
        buf: String,
        pos: usize,
    }
    impl<R: BufRead> KInput<R> {
        pub fn new(src: R) -> Self {
            Self {
                src,
                buf: String::with_capacity(1024),
                pos: 0,
            }
        }
    }
    impl<R: BufRead> Input for KInput<R> {
        fn str(&mut self) -> &str {
            loop {
                if self.pos >= self.buf.len() {
                    self.pos = 0;
                    self.buf.clear();
                    if self.src.read_line(&mut self.buf).expect("io error") == 0 {
                        return &self.buf;
                    }
                }
                let range = self.pos
                    ..self.buf[self.pos..]
                        .find(|c: char| c.is_ascii_whitespace())
                        .map(|i| i + self.pos)
                        .unwrap_or_else(|| self.buf.len());
                self.pos = range.end + 1;
                if range.end > range.start {
                    return &self.buf[range];
                }
            }
        }
    }
    pub struct Iter<'a, T, I: ?Sized>(&'a mut I, std::marker::PhantomData<*const T>);
    impl<'a, T: InputParse, I: Input + ?Sized> Iterator for Iter<'a, T, I> {
        type Item = T;
        fn next(&mut self) -> Option<T> {
            Some(self.0.input())
        }
    }
    pub trait InputParse: Sized {
        fn input<I: Input + ?Sized>(src: &mut I) -> Self;
    }
    impl InputParse for Vec<u8> {
        fn input<I: Input + ?Sized>(src: &mut I) -> Self {
            src.str().as_bytes().to_owned()
        }
    }
    macro_rules! from_str_impl {
        { $($T:ty)* } => {
            $(impl InputParse for $T {
                fn input<I: Input + ?Sized>(src: &mut I) -> Self {
                    src.str().parse::<$T>().expect("parse error")
                }
            })*
        }
    }
    from_str_impl! {
        String char bool f32 f64 isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128
    }
    macro_rules! tuple_impl {
        ($H:ident $($T:ident)*) => {
            impl<$H: InputParse, $($T: InputParse),*> InputParse for ($H, $($T),*) {
                fn input<I: Input + ?Sized>(src: &mut I) -> Self {
                    ($H::input(src), $($T::input(src)),*)
                }
            }
            tuple_impl!($($T)*);
        };
        () => {}
    }
    tuple_impl!(A B C D E F G);
    #[macro_export]
    macro_rules! kdbg {
        ($($v:expr),*) => {
            if cfg!(debug_assertions) { dbg!($($v),*) } else { ($($v),*) }
        }
    }
}


use proconio::input;

fn main() {
    input! {
        x: isize,
        y: isize,
    }

    if y >= 2 * x && y <= 4 * x {
        println!("Yes");
    } else {
        println!("No");
    }
}


use proconio::*;

fn main() {
    input! {
        x: i64,
        y: i64
    }

    let m = 4 * x - y;
    if m % 2 == 0 && m >= 0 {
        println!("Yes");
    }
    else {
        println!("No");
    }
}


func readIntPair() -> (Int, Int) {
    let line = readLine()!.split(separator: " ").map({Int($0)!})
    return (line[0], line[1])
}

let (X, Y) = readIntPair()
if (Y - 2 * X >= 0 && Y % 2 == 0) {
    let t = (Y - 2 * X) / 2
    print(X - t >= 0 ? "Yes" : "No")
} else {
    print("No")
}


let inputs = readLine()!.split(separator: " ").map { Int($0)! }

let X = inputs[0]
let Y = inputs[1]

let y = (2 * X - Y) / -2
let x = X - y

print(x >= 0 && y >= 0 && 2 * x + 4 * y == Y ? "Yes" : "No")


class B {
    static func solve() {
        let XY = readLine()!.split(separator: " ").map { Int($0)! }
        let X = XY[0]
        let Y = XY[1]
        for i in 0...X {
            if i * 2 + (X - i) * 4 == Y {
                print("Yes")
                return
            }
        }

        print("No")
    }
}

B.solve()


import Foundation

let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ")

let x = Int(split[0])!
let y = Int(split[1])!

if (y-2*x>0 && 4*x-y>0 || y-2*x>0 && 4*x-y==0 || y-2*x==0 && 4*x-y>0){
    print("Yes")
}else{
    print("No")
}


import Foundation

let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ")

let x = Double(split[0])!
let y = Double(split[1])!

if (0.5*y-x>0 && 2*x-0.5*y>0 || 0.5*y-x>0 && 2*x-0.5*y==0 || 0.5*y-x==0 && 2*x-0.5*y>0){
    print("Yes")
}else{
    print("No")
}


import Foundation

let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ")

let x = Double(split[0])!
let y = Double(split[1])!

if (0.5*y-x>=0 && 2*x-0.5*y>=0){
    print("Yes")
}else{
    print("No")
}


// import std = require('tstl')

{
  type Print = void | string | number | string[] | number[]
  let outs: Print[] = []

  const main = (): Print => {
    const r = _io()
    const [X, Y] = r.nn()

    // t + k = x
    // t * 2 + k * 2 = x * 2
    // t * 2 + k * 4 = y
    // 2k = y - 2x
    const k = (Y - 2 * X) / 2

    if ((Y - 2 * X) % 2 !== 0) return 'No'
    if (k < 0 || k > X) return 'No'
    // const t = X - k

    return 'Yes'
  }

  const _io = (i = 0) => {
    const str = require('fs').readFileSync('/dev/stdin', 'utf8')
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')

    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map((v) => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  outs.push(main())

  console.log(
    outs
      .map((line) => (typeof line === 'object' ? line.join(' ') : String(line)))
      .join('\n')
  )
}


import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [X, Y] = input[0].map(Number);

  for (let i = 0; i <= X; i++) {
    const legCount = i * 2 + (X - i) * 4;

    if (legCount === Y) {
      return "Yes";
    }
  }

  return "No";
};

console.log(main(read()));


import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');
const [x, y] = input.split(' ');

const t2 = ( 4 * x - y );
if (t2 < 0) {
  console.log('No')
} else if (t2 / 2 > x) {
  console.log('No')
} else {
	console.log( t2 % 2 === 0 ? 'Yes' : 'No' );
}


import { readFileSync } from 'fs'
import { reverse } from 'dns'
import { start } from 'repl'

let lines: string[] = [];
const reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});

reader.on('line', function (line: string) {
    lines.push(line);
});
reader.on('close', function () {
    let [x, y] = lines[0].split(' ').map( _ => parseInt(_))

    if(y % 2 == 1) {
        console.log('No')
    } else {
        if(x * 4 >= y) {
            console.log('Yes')
        } else {
            console.log('No')
        }
    }

});


import { readFileSync } from 'fs'
import { reverse } from 'dns'
import { start } from 'repl'

let lines: string[] = [];
const reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});

reader.on('line', function (line: string) {
    lines.push(line);
});
reader.on('close', function () {
    let x = parseInt(lines[0])
    let y = parseInt(lines[1])
    /* let p = lines[1].split(' ').map( _ => parseInt(_)) */

    if(y % 2 == 1) {
        console.log('No')
    } else {
        if(x * 4 >= y) {
            console.log('Yes')
        } else {
            console.log('No')
        }
    }

});