package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)

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

	var a, b int
	for n > 0 {
		var x int
		fmt.Fscan(reader, &x)

		switch x {
		case 25:
			a++
		case 50:
			if a > 0 {
				a--
				b++
			} else {
				fmt.Println("NO")
				return
			}
		case 100:
			if a > 0 && b > 0 {
				a--
				b--
			} else if a*25 >= x-25 {
				a -= 3
			} else {
				fmt.Println("NO")
				return
			}
		}
		n--
	}

	fmt.Println("YES")
}

// 349A
package main

import (
	"fmt"
)

func main() {
	var a, sum, sum2, n int
	fmt.Scan(&n)
	for i := 1; i <= n; i++ {
		fmt.Scan(&a)
		if a == 25 {
			sum++
		}
		if a == 50 {
			sum--
			sum2++
		}
		if a == 100 {
			if sum2 != 0 {
				sum2--
				sum--
			} else {
				sum -= 3
			}
		}
		if sum < 0 {
			fmt.Print("NO\n")
			return
		}
	}
	fmt.Print("YES\n")
	return
}

package main

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

func Readln(r *bufio.Reader) (string) {
	var (
		isPrefix bool  = true
		err      error = nil
		line, ln []byte
	)
	for isPrefix && err == nil {
		line, isPrefix, err = r.ReadLine()
		ln = append(ln, line...)
	}
	return string(ln)
}

func ReadIntArray(line string) []int {

	numStrings := strings.Split(strings.TrimSpace(string(line)), " ")

	numbers := make([]int, 0)

	for _, v := range numStrings {
		var converted int

		fmt.Sscanf(v, "%d", &converted)
		numbers = append(numbers, converted)
	}

	return numbers
}

func main() {
	reader := bufio.NewReader(os.Stdin)

	Readln(reader)
	line := Readln(reader)
	money := ReadIntArray(string(line))
	if CinemaQueue(money) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func CinemaQueue(money []int) bool {

	change25 := 0
	change50 := 0
	for i := 0; i < len(money); i++ {
		if money[i] == 25 {
			change25++
		} else if money[i] == 50 {
			if change25 > 0 {
				change25--
				change50++
			} else {
				return false
			}
		}
		if money[i] == 100 {
			if change25 >= 1 && change50 >= 1 {
				change25--
				change50--
			} else if change25 >= 3 {
				change25 -= 3
			} else {
				return false
			}
		}
	}

	return true
}

package main
import (
    "fmt"
)
func main() {
    var n,s int
    a,b,c:=0,0,0
    cek := true
    fmt.Scan(&n)
    for i:=0; i<n; i++{
            fmt.Scan(&s)
            if s==25 {
                a++
            } else{
                if s==50 {
                    if a==0 {
                        cek = false
                    } else {
                        a--
                        b++
                    }
                } else {
                    if a>=1 && b>=1 {
                        c++
                        a--
                        b--
                    } else {
                        if a>=3 {
                            a-=3
                            c++
                        } else {cek =false}
                    }
                }
            }
    }
    if cek == true { fmt.Println("YES")
    }else {fmt.Println("NO")}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	total25 := 0
	total50 := 0
	poss := true
	for i := 0; i < n; i++ {
		var y int
		fmt.Scan(&y)
		bal := y - 25
		if bal >= 50 {
			if total50 > 0 {
				total50--
				bal -= 50
			}
		}
		total25 -= bal / 25
		if total25 < 0 {
			poss = false
		}
		if y == 25 {
			total25 = total25 + 1
		} else if y == 50 {
			total50 = total50 + 1
		}
	}
	if poss {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    var n int
    fmt.Scan(&n)
    n25, n50, n100, ans := 0, 0, 0, true
    for i := 0; i < n; i++ {
        scanner.Scan()
        if ans {
            a, _ := strconv.Atoi(scanner.Text())
            if a == 25 {
                n25++
            } else if a == 50 {
                n50++
                if n25 == 0 {
                    ans = false
                } else {
                    n25--
                }
            } else {
                n100++
                if (n25 == 0) || ((n50 == 0) && (n25 < 3)) {
                    ans = false
                } else {
                    if (n50 == 0) { n25 -= 3 } else { n25--; n50-- }
                }
            }
        }
    }
    if ans { fmt.Println("YES") } else { fmt.Println("NO") }
}

package main

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

func main() {
	var a [101]int
	a[25]=0
	a[50]=0
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	for i:=0; i<n ; i++  {
		s.Scan()
		v, _ := strconv.Atoi(s.Text())
		if v == 100 {
			if (a[50]>0 && a[25]>0) || a[25]>2 {
				if a[50]>0 {
					a[50]--
				} else if a[25]>2 {
					a[25]-=2
				}
				a[25]--
				a[100]++
			} else {
				fmt.Println("NO")
				return
			}
		} else if v == 50 {
			if a[25]<1 {
				fmt.Println("NO")
				return
			} else {
				a[25]--
				a[50]++
			}
		} else {
			a[25]++
		}
	}
	fmt.Println("YES")
}

// hey project main.go
package main

import (
    "fmt"
)

func main() {
    var x int
    fmt.Scan(&x)
    q := make([]int, x)
    m := [3]int{0, 0, 0}
    for i := 0; i < x; i++ {
        fmt.Scan(&q[i])
    }
    for i := 0; i < x; i++ {
        if q[i] == 50 {
            if m[0] == 0 {
                fmt.Printf("NO")
                return
            } else {
                m[0]--
                m[1]++
            }
        }
        if q[i] == 100 {
            if m[0] > 0 && m[1] > 0 {
                m[0]--
                m[1]--
            } else if m[0] > 2 {
                m[0] -= 3
            } else {
                fmt.Printf("NO")
                return
            }
        }
        if q[i] == 25 {
            m[0]++
        }
    }
    fmt.Printf("YES")
}

package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    var n int
    fmt.Scan(&n)
    n25, n50, n100, ans := 0, 0, 0, true
    for i := 0; i < n; i++ {
        scanner.Scan()
        a, _ := strconv.Atoi(scanner.Text())
        if a == 25 {
            n25++
        } else if a == 50 {
            n50++
            if n25 == 0 { ans = false }
        } else {
            n100++
            if (n25 == 0) || ((n50 == 0) && (n25 < 3)) { ans = false }
        }
    }
    if ans { fmt.Println("YES") } else { fmt.Println("NO") }
}

package main

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

func main() {
	var a [101]int
	a[25]=0
	a[50]=0
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	for i:=0; i<n ; i++  {
		s.Scan()
		v, _ := strconv.Atoi(s.Text())
		if v == 100 {
			if a[25]<3 || (a[50]<1 && a[25]<1) {
				fmt.Println("NO")
				return
			} else {
				if a[50]>0 {
					a[50]--
				} else {
					a[25]-=2
				}
				a[25]--
				a[100]++
			}
		} else if v == 50 {
			if a[25]<1 {
				fmt.Println("NO")
				return
			} else {
				a[25]--
				a[50]++
			}
		} else {
			a[25]++
		}
	}
	fmt.Println("YES")
}

package main

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

func main() {
	var a [101]int
	a[25]=0
	a[50]=0
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	for i:=0; i<n ; i++  {
		s.Scan()
		v, _ := strconv.Atoi(s.Text())
		if v == 100 {
			if (a[50]<1 && a[25]<1) || a[25]<3 {
				fmt.Println("NO")
				return
			} else {
				if a[50]>0 {
					a[50]--
				} else if a[25]>2 {
					a[25]-=2
				}
				a[25]--
				a[100]++
			}
		} else if v == 50 {
			if a[25]<1 {
				fmt.Println("NO")
				return
			} else {
				a[25]--
				a[50]++
			}
		} else {
			a[25]++
		}
	}
	fmt.Println("YES")
}

package main

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

func main() {
	var a [101]int
	a[25]=0
	a[50]=0
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	for i:=0; i<n ; i++  {
		s.Scan()
		v, _ := strconv.Atoi(s.Text())
		if v == 100 {
			if a[50]<1 || a[25]<1 {
				fmt.Println("NO")
				return
			} else {
				a[50]--
				a[25]--
				a[100]++
			}
		} else if v == 50 {
			if a[25]<1 {
				fmt.Println("NO")
				return
			} else {
				a[25]--
				a[50]++
			}
		} else {
			a[25]++
		}
	}
	fmt.Println("YES")
}

// 349A
package main

import (
	"fmt"
)

func main() {
	var a, sum, sum2, n int
	fmt.Scan(&n)
	for i := 1; i <= n; i++ {
		fmt.Scan(&a)
		if a == 25 {
			sum++
		}
		if a == 50 {
			sum--
			sum2++
		}
		if a == 100 {
			if sum2 != 0 {
				sum2--
				sum--
			} else {
				sum -= 3
			}
		}
		if sum < 0 {
			fmt.Print("NO\n")
			return
		}
		fmt.Print("YES\n")
		return
	}
}

// 349A
package main

import (
	"fmt"
)

func main() {
	var a, sum, sum2, n int
	fmt.Scan(&n)
	for i := 1; i <= n; i++ {
		fmt.Scan(&a)
		if a == 25 {
			sum++
		}
		if a == 50 {
			sum--
			sum2++
		}
		if a == 100 {
			if sum2 != 0 {
				sum2--
				sum--
			} else {
				sum -= 3
			}
			if sum < 0 {
				fmt.Print("NO\n")
				return
			}
		}
		fmt.Print("YES\n")
		return
	}
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)

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

	var a int
	for n > 0 {
		var x int
		fmt.Fscan(reader, &x)

		switch x {
		case 25:
			a++
		case 50:
			if a > 0 {
				a--
			} else {
				fmt.Println("NO")
				return
			}
		case 100:
			if a*25 >= x {
				a -= 4
			} else {
				fmt.Println("NO")
				return
			}
		}
		n--
	}

	fmt.Println("YES")
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)

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

	var a, b int
	for n > 0 {
		var x int
		fmt.Fscan(reader, &x)

		switch x {
		case 25:
			a++
		case 50:
			if a > 0 {
				a--
				b++
			} else {
				fmt.Println("NO")
				return
			}
		case 100:
			if a*25 >= x-25 {
				a -= 3
			} else if a > 0 && b > 0 {
				a--
				b--
			} else {
				fmt.Println("NO")
				return
			}
		}
		n--
	}

	fmt.Println("YES")
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)

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

	var a int
	for n > 0 {
		var x int
		fmt.Fscan(reader, &x)

		switch x {
		case 25:
			a++
		case 50:
			if a > 0 {
				a--
			} else {
				fmt.Println("NO")
				return
			}
		case 100:
			if a > 0 {
				a--
			} else {
				fmt.Println("NO")
				return
			}
		}
		n--
	}

	fmt.Println("YES")
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)

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

	var a, b int
	for n > 0 {
		var x int
		fmt.Fscan(reader, &x)

		switch x {
		case 25:
			a++
		case 50:
			if a > 0 {
				a--
				b++
			} else {
				fmt.Println("NO")
				return
			}
		case 100:
			if a*25 >= x {
				a -= 4
			} else if a > 0 && b > 0 {
				a--
				b--
			} else {
				fmt.Println("NO")
				return
			}
		}
		n--
	}

	fmt.Println("YES")
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)

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

	var a, b int
	for n > 0 {
		var x int
		fmt.Fscan(reader, &x)

		switch x {
		case 25:
			a++
		case 50:
			if a > 0 {
				a--
			} else {
				fmt.Println("NO")
				return
			}
		case 100:
			if a > 0 && b > 0 {
				a--
				b--
			} else {
				fmt.Println("NO")
				return
			}
		}
		n--
	}

	fmt.Println("YES")
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)

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

	var a int
	for n > 0 {
		var x int
		fmt.Fscan(reader, &x)

		switch x {
		case 25:
			a++
		case 50:
			if a > 0 {
				a++
			} else {
				fmt.Println("NO")
				return
			}
		case 100:
			if a*25 >= x-25 {
				a -= 3
			} else {
				fmt.Println("NO")
				return
			}
		}
		n--
	}

	fmt.Println("YES")
}


package main

import (
	"fmt"
)

func main() {
	var n, ans int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var p, q int
		fmt.Scan(&p, &q)
		if q-p >= 2 {
			ans++
		}
	}
	fmt.Println(ans)
}

package main

import (
    "fmt"
    //"strings"
)

func main() {
    var n int = 0
    fmt.Scan(&n)
    var p,q [101]int
    for x:=0;x<n;x++{
        fmt.Scan(&p[x])
        fmt.Scan(&q[x])
    }
    tot:=0
    for x:=0;x<n;x++{
        if p[x]+2<=q[x]{
            tot++
        }
    }
    fmt.Println(tot)

}

package main

import (
	"fmt"
)

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

	var a, b int
	for i:=0; i<n; i++ {
		fmt.Scan(&a, &b)
		if b - a >= 2 {counter++}
	}
	fmt.Println(counter)
}

package main

import (
	"fmt"
)

func main() {
	var res, N, x, y int

	fmt.Scanln(&N)
	for i := 0; i < N; i++ {
		fmt.Scanln(&x, &y)
		if y-x >= 2 {
			res++
		}
	}
	fmt.Println(res)
}

package main

import "fmt"

func main() {
	var n, p, q int
	fmt.Scanf("%d\n", &n)
	count := 0
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d\n", &p, &q)
		if q-p > 1 {
			count++
		}
	}
	fmt.Println(count)
}

package main

import "fmt"

func main() {
	var num int
	_, _ = fmt.Scanln(&num)
	matrix := make([][2]int32,num)
	count := 0
	for i:=0; i<num; i++ {
		for j:=0;j<2; j++ {
			_, _ = fmt.Scan(&matrix[i][j])
		}
		if matrix[i][0] < matrix[i][1] {
			if matrix[i][1] - matrix[i][0] >= 2 {
				count++
			}
		}
	}
	fmt.Print(count)
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)

func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {
	var num uint
	_, _ = fmt.Scanln(&num)
	matrix := make([][2]uint32, num, num+3)
	var count, i uint = 0, 0
	for i = 0; i < num; i++ {
		scanf("%d %d\n", &matrix[i][0], &matrix[i][1])
		if matrix[i][0] < matrix[i][1] {
			if matrix[i][1]-matrix[i][0] >= 2 {
				count++
			}
		}
	}
	fmt.Print(count)
}

package main
import "fmt"

func main(){
	var (
		n, p, q int
		count int
	)
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d\n", &p, &q)
		if q - p >= 2 {
			count += 1
		}
	}

	fmt.Println(count)
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	p, q, count := 0, 0, 0

	for i := 0; i < n; i++ {
		p, q = nextInt(), nextInt()

		if q - p >= 2 {
			count++
		}
	}

	println(count)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(next())
	if err != nil {
		panic(err)
	}
	return n
}

func nextFloat() float64 {
	n, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		panic(err)
	}
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

package main

import(
    "fmt"
)

type u32 uint32

func main(){
    var(
        n,a,b,res u32
    )
    fmt.Scan(&n)
    res = 0
    for n>0 {
        fmt.Scan(&a,&b)
        if b-a>=2{
            res++
        }
        n--
    }
    fmt.Println(res)
}

package main

import (
	"fmt"
)

func main() {
	var t , i int
	fmt.Scan(&t)
	var cnt int
	    cnt = 0
	for i = 0 ; i < t ; i++ {
	    var p , q int
	    fmt.Scan(&p , &q)
	    if q - p >= 2 {
	        cnt++;
	    }
	}
	fmt.Println(cnt)
}

package main

import "fmt"

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

	total := 0
	var p, q int
	for i := 0; i < count; i++ {
		fmt.Scan(&p, &q)
		if q - p >= 2 {
			total ++
		}
	}

	fmt.Println(total)
}

package main

import "fmt"

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

	total := 0
	for i := 0; i < count; i++ {
		var p, q int
		fmt.Scan(&p, &q)
		if q - p >= 2 {
			total ++
		}
	}

	fmt.Println(total)
}

package main

import (
	"fmt"
)

func main() {
	var n, x, y int
	fmt.Scan(&n)
	res := 0
	for i := 1; i <= n; i++ {
		fmt.Scan(&x, &y)
		if y-x >= 2 {
			res++
		}
	}
	fmt.Println(res)
}

package main

import (
  "fmt"
)

func main() {
  var n, p, c, r int
  fmt.Scan(&n)
  for i := 0; i < n; i++ {
    fmt.Scan(&p,&c)
    if c-p>=2 {
      r++
    }
  }
  fmt.Print(r)
}

package main

import "fmt"

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

	var rooms, p, q int
	for i := 0; i < n; i++ {
		fmt.Scan(&p, &q)
		if q-p > 1 {
			rooms++
		}
	}
	fmt.Print(rooms)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	var count int
	for i := 0; i < n; i++ {
		var p, q int
		fmt.Scan(&p, &q)
		if q-p >= 2 {
			count++
		}
	}
	fmt.Println(count)
}

package main

import (
	"fmt"
)

func main() {
	var n, p, q, cnt int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&p, &q)
		if q - p >= 2 {
			cnt++
		}
	}
	fmt.Print(cnt)
}

package main

import "fmt"

func main() {
    n := 0
    ans := 0
    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        a := 0
        b := 0
        fmt.Scan(&a)
        fmt.Scan(&b)
        if b-a >= 2 {
            ans++
        }
    }
    fmt.Println(ans)
}

package main

import "fmt"

func main() {

	var n int
	var p, q int
	sum := 0

	_, _ = fmt.Scanln(&n)

	for i := 0; i < n; i++ {
		_, _ = fmt.Scanln(&p, &q)
		if q - p >= 2 {
			sum ++
		}
	}

	fmt.Println(sum)
}

package main

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

func main() {
	var scanner *bufio.Scanner
	var lines, room []string
	var free int
	var p, q int

	scanner = bufio.NewScanner(os.Stdin)

	for scanner.Scan() {
		lines = append(lines, scanner.Text())
	}

	for _, line := range lines[1:] {
		room = strings.Fields(line)
		p, _ = strconv.Atoi(room[0])
		q, _ = strconv.Atoi(room[1])

		if (q - p) >= 2 {
			free++
		}
	}

	fmt.Println(free)
}

package main

import (
	"fmt"
)

var (
	n      int
	p      []int
	q      []int
	result int = 0
)

func in() {
	fmt.Scanln(&n)
	p = make([]int, n)
	q = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d\n", &p[i], &q[i])
	}
}

func out() {
	fmt.Println(result)
}

func run() {
	for i := 0; i < n; i++ {
		if q[i]-p[i] >= 2 {
			result++
		}
	}
}

func main() {
	in()
	run()
	out()
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strings"
)

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1024 * 1024)
	n := 0
	fmt.Sscanf(readLine(reader), "%d", &n)
	res := 0
	for i := 0; i < n; i++ {
		var p, q int
		fmt.Sscanf(readLine(reader), "%d %d", &p, &q)
		if q - p >= 2 {
			res++
		}
	}
	fmt.Println(res)
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

package main

import "fmt"

func main() {
	var n, c int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var p, q int
		fmt.Scan(&p, &q)
		if q-p >= 2 {
			c++
		}
	}
	fmt.Print(c)
}

package main
import (
	"fmt"
)
func main() {
	var no, a, b, avail, tmp, sum int
	fmt.Scan(&no)
	avail = 0
	tmp = 0
	arr := []int{}
	arr1 := []int{}
	//total := []int{}
	for i := 0; i < no; i++ {
		fmt.Scan(&a, &b)
		arr = append(arr, a)
		arr1 = append(arr1, b)
	}
	for j := 0; j < len(arr); j++ {
		if arr[j] == arr1[j] {
			tmp = 0
			//total = append(total, avail)
		}
		if arr[j] < arr1[j] {
			if arr1[j] - arr[j] >= 2 {
				avail = avail + 1
				//total = append(total, avail)
			}
		}
	}
	sum = tmp + avail
	fmt.Println(sum)

}

package main

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

func main() {
	total := 0
	scanner := bufio.NewScanner(os.Stdin)
	// Skip first line.
	scanner.Scan()
	var p, q int
	for scanner.Scan() {
		if _, err := fmt.Sscanf(scanner.Text(), "%d %d", &p, &q); err != nil {
			continue
		}
		if q-p >= 2 {
			total++
		}
	}
	fmt.Println(total)
}

package main

import (
	"fmt"
)

func main() {
	var n, p, q, r int

	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		fmt.Scan(&p, &q)

		if q-p >= 2 {
			r++
		}
	}

	fmt.Println(r)
}

/*
George and Accommodation
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
George has recently entered the BSUCP (Berland State University for Cool Programmers). George has a friend Alex who has also entered the university. Now they are moving into a dormitory.

George and Alex want to live in the same room. The dormitory has n rooms in total. At the moment the i-th room has pi people living in it and the room can accommodate qi people in total (pi ≤ qi). Your task is to count how many rooms has free place for both George and Alex.

Input
The first line contains a single integer n (1 ≤ n ≤ 100) — the number of rooms.

The i-th of the next n lines contains two integers pi and qi (0 ≤ pi ≤ qi ≤ 100) — the number of people who already live in the i-th room and the room's capacity.

Output
Print a single integer — the number of rooms where George and Alex can move in.

Sample test(s)
input
3
1 1
2 2
3 3
output
0
input
3
1 10
0 10
10 10
output
2
*/

package main

import (
	"fmt"
)

func main() {
	var n, counter int
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var p, q int
		fmt.Scanf("%d %d\n", &p, &q)
		if q - p >= 2 {
			counter++
		}
	}
	fmt.Println(counter)
}

package main

import "fmt"

func main() {
	var dormNum int
	var in, volume int
	var counter int
	fmt.Scan(&dormNum)
	for offset := 0; offset < dormNum; offset++ {
		fmt.Scan(&in, &volume)
		if volume - in >= 2 {
			counter += 1
		}
	}
	fmt.Print(counter)
}

package main
import "fmt"
func main () {
    var h int
    fmt.Scan(&h)
    c:=0
    n:=0
    m:=0
    for i:=0;i<h;i++ {
        fmt.Scan(&n,&m)
        if m-n>1{
            c++
        }
    }
    fmt.Println(c)
}

package main

import (
	"fmt"
)

func main() {
	var n, p, q int
	fmt.Scan(&n)
	z := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&p)
		fmt.Scan(&q)
		if q-p >= 2 {
			z++
		}
	}
	fmt.Println(z)
}

package main

import "fmt"

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

	num := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&x, &y)
		if y-x >= 2 {
			num += 1
		}
	}

	fmt.Print(num)
}

package main

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

var n int

func main() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader := bufio.NewReaderSize(stdin, 1<<20)
	fmt.Fscanf(reader, "%d\n", &n)

	ans := 0
	for ; n != 0; n-- {
		var p, q int
		fmt.Fscanf(reader, "%d%d\n", &p, &q)
		if q-p >= 2 {
			ans++
		}
	}

	fmt.Println(ans)
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var n, p, q, c uint8
	fmt.Fscanf(in, "%d\n", &n)
	for i := 0; uint8(i) < n; i++ {
		fmt.Fscanf(in, "%d %d\n", &p, &q)
		if q-p > 1 {
			c++
		}
	}
	fmt.Println(c)
}

package main

import (
	"fmt"
)

func main() {
	var n, p, q, ctr int
	fmt.Scan(&n)
	for n > 0 {
		fmt.Scan(&p, &q)
		if q-p >= 2 {
			ctr++
		}
		n--
	}
	fmt.Println(ctr)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	var cnt int
	for i := 0; i < n; i++ {
		var m, l int
		fmt.Scan(&m, &l)
		if l-m >= 2 {
			cnt++
		}
	}
	fmt.Print(cnt)
}

package main

import (
	"fmt"
)

func main() {
	var n, p, q, c int
	fmt.Scan(&n)

	for n > 0 {
		fmt.Scan(&p, &q)
		if q-p >= 2 {
			c++
		}
		n--
	}
	fmt.Println(c)
}

package main

import (
	"fmt"
	"io"
	"os"
)

func cf467a(in io.Reader, out io.Writer) {

	var n, occupied, total, eligible int
	fmt.Fscan(in, &n)
	for n > 0 {
		n--
		fmt.Fscan(in, &occupied, &total)
		if total-occupied >= 2 {
			eligible++
		}
	}
	fmt.Println(eligible)
}

func main() { cf467a(os.Stdin, os.Stdout) }

package main

import (
    "fmt"
)

func main() {
    var n, p, q, r int

    fmt.Scan(&n)

    for i := 0; i < n; i++ {
        fmt.Scan(&p, &q)

        if q-p >= 2 {
            r++
        }
    }

    fmt.Println(r)
}

package main

import "fmt"

func main() {
	var n, p, q, r int
	fmt.Scan(&n)
	for i := 0; i < n; i ++ {
		fmt.Scan(&p)
		fmt.Scan(&q)
		if q - p >= 2 {
			r ++
		}
	}
	fmt.Println(r)
}

// ░░░░░░░░░░░░░░░SPINDYZEL░░░░░░░░░░░░░░░
// ░░░░░░░░░░▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄░░░░░░░░░
// ░░░░░░░░▄▀░░░░░░░░░░░░▄░░░░░░░▀▄░░░░░░░
// ░░░░░░░░█░░░░░░░░░░░░▄█▄▄░░▄░░░█░▄▄▄░░░
// ░▄▄▄▄▄░░█░░░░░░▀░░░░▀█░░▀▄░░░░░█▀▀░██░░
// ░██▄▀██▄█░░░▄░░░░░░░██░░░░▀▀▀▀▀░░░░██░░
// ░░▀██▄▀██░░░░░░░░▀░██▀░░░░░░░░░░░░░▀██░
// ░░░░▀████░▀░░░░▄░░░██░░░▄█░░░░▄░▄█░░██░
// ░░░░░░░▀█░░░░▄░░░░░██░░░░▄░░░▄░░▄░░░██░
// ░░░░░░░▄█▄░░░░░░░░░░░▀▄░░▀▀▀▀▀▀▀▀░░▄▀░░
// ░░░░░░█▀▀█████████▀▀▀▀████████████▀░░░░
// ░░░░░░████▀░░███▀░░░░░░▀███░░▀██▀░░░░░░

package main

import "fmt"

func main() {
	var n, p, q int
	ans := 0
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&p, &q)
		if q-p >= 2 {
			ans++
		}
	}
	fmt.Println(ans)
}

package main

import (
	"fmt"
)

func main() {
	var room, p, c, res int
	res = 0
	fmt.Scan(&room)
	for room != 0 {
		fmt.Scan(&p, &c)
		if c-p >= 2 {
			res++
		}
		room--
	}
	fmt.Println(res)
}

package main

import (
	"fmt"
)

func main() {
	var n, p, q int
	a := 0
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d\n", &p, &q)
		if q-p > 1 {
			a++
		}
	}
	fmt.Println(a)
}

package main

import "fmt"

func main() {
    var n int
    fmt.Scanf("%d\n", &n)

    num := 0
    for i := 0; i < n; i++ {
        var p, q int
        fmt.Scan(&p, &q)
        if q - p >= 2 {
            num++
        }
    }

    fmt.Println(num)
}

package main
import (
	"fmt"
)
func main() {
	var n,ct,p,q int
	ct=0
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&p,&q)
		if q-p >= 2 {
			ct += 1
		}
	}
	fmt.Println(ct)
}

package main

import (
    "fmt"
)

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

    cnt := 0
    for i := 0 ; i < n ; i++ {
        var p, q int
        fmt.Scan(&p, &q)
        if (q - p) >= 2 {
            cnt++
        }
    }
    fmt.Println(cnt)
}

package main

import (
	"fmt"
	"os"
)

func main() {
	var n int
	scanf("%d\n", &n)
	var cnt int
	for i := 0; i < n; i++ {
		var p, q int
		scanf("%d %d\n", &p, &q)
		if q-p >= 2 {
			cnt++
		}
	}
	printf("%d\n", cnt)
}

func printf(format string, x ...interface{}) {
	fmt.Fprintf(os.Stdout, format, x...)
}

func scanf(format string, x ...interface{}) {
	if _, err := fmt.Fscanf(os.Stdin, format, x...); err != nil {
		panic(err)
	}
}

package main

import "fmt"

func main() {
	var n, ret int
	ret = 0
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var p, q int
		fmt.Scan(&p)
		fmt.Scan(&q)
		if q - p >= 2 {
			ret++
		}
	}

	fmt.Println(ret)
}

package main

import "fmt"

func main() {
	var testcount, a, b, count int
	fmt.Scanf("%d\n", &testcount)
	for i := 0; i < testcount; i++ {
		fmt.Scanf("%d %d\n", &a, &b)
		if b-a >= 2 {
			count++
		}
	}
	fmt.Println(count)
}

package main;

import (
  "fmt"
)

func main() {
  var n int;
  fmt.Scanf("%d", &n);
  var ans = 0;
  for i := 0; i < n; i++ {
    var p, q int;
    fmt.Scan(&p, &q);
    if q - p >= 2 {
      ans++;
    }
  }
  fmt.Printf("%d", ans);
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	count := 0
	var p, q int
	for i := 0; i < n; i++ {
		fmt.Scan(&p, &q)
		if q-p > 1 {
			count++
		}
	}
	fmt.Print(count)
}

package main

import (
	"fmt"
)

func main() {
	var n, a, b, ans int
	ans = 0
	fmt.Scanf("%d ", &n)
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d %d ", &a, &b)
		if b-a >= 2 {
			ans++
		}
	}
	fmt.Printf("%d\n", ans)
}

package main

import "fmt"

// https://codeforces.com/problemset/problem/467/A
// A. George and Accommodation
// time limit per test
// 1 second
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// George has recently entered the BSUCP (Berland State University for Cool Programmers). George has a friend Alex who has also entered the university. Now they are moving into a dormitory.

// George and Alex want to live in the same room. The dormitory has n rooms in total. At the moment the i-th room has pi people living in it and the room can accommodate qi people in total (pi ≤ qi). Your task is to count how many rooms has free place for both George and Alex.
// Input

// The first line contains a single integer n (1 ≤ n ≤ 100) — the number of rooms.

// The i-th of the next n lines contains two integers pi and qi (0 ≤ pi ≤ qi ≤ 100) — the number of people who already live in the i-th room and the room's capacity.
// Output

// Print a single integer — the number of rooms where George and Alex can move in.

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

	var nPossible int
	for i := 0; i < n; i++ {
		var pi, qi int
		fmt.Scan(&pi, &qi)

		if qi-pi >= 2 {
			nPossible++
		}
	}

	fmt.Print(nPossible)
}

package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Scan()
    n, _ := strconv.Atoi(scanner.Text())

    ans := 0
    for i := 0; i < n; i++ {
        scanner.Scan()
        arr := strings.Split(scanner.Text(), " ")
        p, _ := strconv.Atoi(arr[0])
        q, _ := strconv.Atoi(arr[1])

        if ((q - p) >= 2) {
            ans++
        }
    }
    fmt.Println(ans)
}

package main

import (
	"fmt"
)

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

	ans := 0
	for i:=1; i<=N; i++{
		var p,q int
		fmt.Scan(&p, &q)
		if q-p >= 2 {
			ans++
		}
	}

	fmt.Println(ans)
}

package main

// https://codeforces.com/problemset/problem/467/A

import "fmt"

type room struct {
	size     int
	capasity int
}

func taskSolution(a []room) (ans int) {
	const friends = 2
	for _, r := range a {
		if friends+r.size <= r.capasity {
			ans += 1
		}
	}
	return ans
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	a := []room{}
	for i := 0; i < n; i += 1 {
		var p, q int
		if _, err := fmt.Scan(&p, &q); err != nil {
			panic(err)
		}
		a = append(a, room{p, q})
	}

	fmt.Println(taskSolution(a))
}

package main

import (
	"fmt"
)

func main() {
	var n, p, q int
	fmt.Scanln(&n)

	rooms := 0
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d\n", &p, &q)
		if q-p >= 2 {
			rooms++
		}
	}

	fmt.Println(rooms)
}

package main

import (
	"fmt"
)

func main() {
	var n, p, q, r int

	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		fmt.Scan(&p, &q)

		if q-p >= 2 {
			r++
		}
	}

	fmt.Println(r)
}

package main

import "fmt"

func main() {
	var num int
	_, _ = fmt.Scanln(&num)
	matrix := make([][2]int32,num)
	count :=0
	for i:=0; i<num; i++ {
		for j:=0;j<2; j++ {
			_, _ = fmt.Scan(&matrix[i][j])
		}
		if matrix[i][0] < matrix[i][1] {
			count++
		}
	}
	fmt.Print(count)
}

package main
import "fmt"

func main(){
	var (
		n, p, q int
		count int
	)
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d\n", &p, &q)
		if q - p > 2 {
			count += 1
		}
	}

	fmt.Println(count)
}

package main

import "fmt"

func main() {
    n := 0
    ans := 0
    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        a := 0
        b := 0
        fmt.Scan(&a)
        fmt.Scan(&b)
        if a < b {
            ans++
        }
    }
    fmt.Println(ans)
}

/*
George and Accommodation
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
George has recently entered the BSUCP (Berland State University for Cool Programmers). George has a friend Alex who has also entered the university. Now they are moving into a dormitory.

George and Alex want to live in the same room. The dormitory has n rooms in total. At the moment the i-th room has pi people living in it and the room can accommodate qi people in total (pi ≤ qi). Your task is to count how many rooms has free place for both George and Alex.

Input
The first line contains a single integer n (1 ≤ n ≤ 100) — the number of rooms.

The i-th of the next n lines contains two integers pi and qi (0 ≤ pi ≤ qi ≤ 100) — the number of people who already live in the i-th room and the room's capacity.

Output
Print a single integer — the number of rooms where George and Alex can move in.

Sample test(s)
input
3
1 1
2 2
3 3
output
0
input
3
1 10
0 10
10 10
output
2
*/

package main

import (
	"fmt"
)

func main() {
	var n, p, q, counter int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d", &p, &q)
		if q - p >= 2 {
			counter++
		}
	}
	fmt.Println(counter)
}

/*
George and Accommodation
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
George has recently entered the BSUCP (Berland State University for Cool Programmers). George has a friend Alex who has also entered the university. Now they are moving into a dormitory.

George and Alex want to live in the same room. The dormitory has n rooms in total. At the moment the i-th room has pi people living in it and the room can accommodate qi people in total (pi ≤ qi). Your task is to count how many rooms has free place for both George and Alex.

Input
The first line contains a single integer n (1 ≤ n ≤ 100) — the number of rooms.

The i-th of the next n lines contains two integers pi and qi (0 ≤ pi ≤ qi ≤ 100) — the number of people who already live in the i-th room and the room's capacity.

Output
Print a single integer — the number of rooms where George and Alex can move in.

Sample test(s)
input
3
1 1
2 2
3 3
output
0
input
3
1 10
0 10
10 10
output
2
*/

package main

import (
	"fmt"
)

func main() {
	var n, counter int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var p, q int
		fmt.Scanf("%d %d", &p, &q)
		if q - p >= 2 {
			counter++
		}
	}
	fmt.Println(counter)
}

package main

import "fmt"

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

    num := 0
    for i := 0; i < n; i++ {
        var p, q int
        fmt.Scanf("%d %d\n", &p, &q)
        if q - p >= 2 {
            num++
        }
    }

    fmt.Println(num)
}

package main

import "fmt"

func main() {
	var n, ret int
	ret = 0
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var p, q int
		fmt.Scanf("%d", &p)
		fmt.Scanf("%d", &q)
		if p < q {
			ret++
		}
	}

	fmt.Println(ret)
}

package main

import "fmt"

func main() {
	var n, ret int
	ret = 0
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var p, q int
		fmt.Scan(&p)
		fmt.Scan(&q)
		if p < q {
			ret++
		}
	}

	fmt.Println(ret)
}

package main

import "fmt"

func main() {
	var n, ret int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var p, q int
		fmt.Scanf("%d %d", &p, &q)
		if p < q {
			ret++
		}
	}

	fmt.Println(ret)
}

package main

import "fmt"

func main() {
	var n, ret int
	ret = 0
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var p, q int
		fmt.Scanf("%d %d", &p, &q)
		if p < q {
			ret++
		}
	}

	fmt.Println(ret)
}

package main;

import (
  "fmt"
)

func main() {
  var n int;
  fmt.Scanf("%d", &n);
  var ans = 0;
  for i := 0; i < n; i++ {
    var p, q int;
    fmt.Scanf("%d %d", &p, &q);
    if q - p >= 2 {
      ans++;
    }
  }
  fmt.Printf("%d", ans);
}

package main;

import (
  "fmt"
)

func main() {
  var n int;
  fmt.Scanf("%d", &n);
  var ans = 0;
  for i := 0; i < n; i++ {
    var p, q int;
    fmt.Scanf("%d %d\n", &p, &q);
    if q - p >= 2 {
      ans++;
    }
  }
  fmt.Printf("%d", ans);
}


package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"math"
	"os"
)

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)

	var a, v, l, d, w float64

	fmt.Fscanf(reader, "%f %f\n", &a, &v)
	fmt.Fscanf(reader, "%f %f %f\n", &l, &d, &w)

	vx := math.Sqrt(2 * a * d)
	vy := math.Sqrt(a*d + w*w/2)
	var v1, t1, t2 float64

	if vx <= v && vx <= w {
		v1 = vx
		t1 = math.Sqrt(2.0 * d / a)
	} else if vx > v && v <= w {
		v1 = v
		t1 = v/(a) + (d-v*v/(2*a))/v
	} else if w < vx && vy <= v {
		v1 = w
		t1 = (vy*2 - w) / a
	} else if w < vx && vy > v {
		v1 = w
		t1 = (2*a*d + 2*v*v + w*w - 2*w*v) / (2 * a * v)
	}

	d1 := l - d

	s := (v*v - v1*v1) / (2 * a)

	if s >= d1 {
		t2 = (math.Sqrt(2*a*d1+v1*v1) - v1) / a
	} else {
		t2 = (v-v1)/a + (d1-s)/v
	}
	fmt.Printf("%f", t1+t2)
}

package main

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

var debug bool = false

func solve() {
	a := float64(readInt()) // acceleration of car
	v := float64(readInt()) // maximum velocity of car
	l := float64(readInt()) // total length of road
	d := float64(readInt()) // distance from beginning of limit
	w := float64(readInt()) // instantaneous speed limit

	if v < w {
		// If maximum velocity of car < speed limit, we
		// accelerate to maximum speed of car and travel
		// the rest of the way at that speed... or we
		// accelerate the whole way (never reaching max)
		fmt.Println(lastSection(a, v, l, 0.0))
		return
	}

	// time to reach 'd' at full acceleration
	td := math.Sqrt(2.0 * (d / a))

	// velocity at 'd' from full acceleration
	vd := a * td

	if debug {
		fmt.Println("full a td", td, "vd", vd)
	}

	if vd <= w {
		// At full acceleration, we we haven't reached the
		// limit, this is the same simple case as above
		fmt.Println(lastSection(a, v, l, 0.0))
		return
	}

	// Now, we know we can actually reach 'w' before we get to 'd'.
	// So, if we go flat out 'a' from 0 will we reach 'v' before we
	// have to start decelerating to be at 'w' by 'd'.
	//
	// Now we need to figure out whether we accelerate up to 'v',
	// cruise at v for awhile, then decelerate to 'w' OR we accelerate
	// as much as possible then decelerate to 'w'.

	// For now let's assume we'll accelerate and decelerate only
	// (no time spent at 'v').

	t_a := math.Sqrt((d / a) + math.Pow(w, 2.0)/(2.0*math.Pow(a, 2.0)))
	t_d := t_a - w/a
	t_v := 0.0
	t := t_a + t_d + t_v

	v_i := a * t_a

	if debug {
		fmt.Println("a", a, "l", l, "v", v, "d", d, "w", w)
		fmt.Println("vi", v_i, "ta", t_a, "td", t_d)
	}

	if v_i > v {
		// We have to spend some time cruising at 'v'
		t_a = (v - 0.0) / a
		t_d = (v - w) / a

		dl := d
		dl -= 0.5 * (v + 0.0) * t_a
		dl -= 0.5 * (v + w) * t_d
		t_v = dl / v
		if debug {
			fmt.Println("ta", t_a, "td", t_d, "tv", t_v)
		}
		t = t_a + t_d + t_v
		v_i = w
	}

	if debug {
		fmt.Println("T", t)

		fmt.Println("d_a", 0.5*a*t_a*t_a)
		fmt.Println("d_d", 0.5*(w+v_i)*t_d)
	}

	l -= d

	fmt.Println(t + lastSection(a, v, l, w))
}

func lastSection(a, v, l, v0 float64) float64 {
	// simple case, either we accelerate all the way
	// (if we hit v after l), or we hit v and travel
	// the rest of the way at constant velocity 'v'

	// Can we just accelerate to the end? (staying under 'v')
	if debug {
		fmt.Println("last", "a", a, "v", v, "l", l, "v0", v0)
	}

	vend := math.Sqrt(v0*v0 + 2.0*a*l)
	if vend <= v {
		// we reach the end before 'v' matters
		return l / (0.5 * (vend + v0))
	}

	tv := (v - v0) / a // time to reach v (from v0)

	// distance covered during acceleration
	d := 0.5 * (v + v0) * tv
	if debug {
		fmt.Println("tv", tv, "d", d, "l-d", l-d)
	}

	// take away distance covered accelerating to 'v'
	l -= d

	// How long to to cover the remaining distance?
	tl := l / v

	// result is sum of the two
	return (tv + tl)
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

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

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"math"
	"os"
)

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)

	var a, v, l, d, w float64

	fmt.Fscanf(reader, "%f %f\n", &a, &v)
	fmt.Fscanf(reader, "%f %f %f\n", &l, &d, &w)

	vx := math.Sqrt(2 * a * d)
	vy := math.Sqrt(a*d + w*w/2)
	var v1, t1, t2 float64

	if vx <= v && vx <= w {
		v1 = vx
		t1 = math.Sqrt(2.0 * d / a)
	} else if vx > v && vx <= w {
		v1 = v
		t1 = v/(2*a) + d/v
	} else if w < vx && vy <= v {
		v1 = w
		t1 = (vy*2 - w) / a
	} else if w < vx && vy > v {
		v1 = w
		t1 = (2*a*d + 2*v*v + w*w - 2*w*v) / (2 * a * v)
	}

	d1 := l - d

	s := (v*v - v1*v1) / (2 * a)

	if s >= d1 {
		t2 = (math.Sqrt(2*a*d1+v1*v1) - v1) / a
	} else {
		t2 = (v-v1)/a + (d1-s)/v
	}
	fmt.Printf("%f", t1+t2)
}

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"math"
	"os"
)

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)

	var a, v, l, d, w float64

	fmt.Fscanf(reader, "%f %f\n", &a, &v)
	fmt.Fscanf(reader, "%f %f %f\n", &l, &d, &w)

	vx := math.Sqrt(2 * a * d)
	vy := math.Sqrt(a*d + w*w/2)
	var v1, t1, t2 float64

	if vx <= v && vx <= w {
		v1 = vx
		t1 = math.Sqrt(2.0 * w / a)
	} else if vx > v && vx <= w {
		v1 = v
		t1 = v/(2*a) + d/v
	} else if w < vx && vy <= v {
		v1 = w
		t1 = (vy*2 - w) / a
	} else if w < vx && vy > v {
		v1 = w
		t1 = (2*a*d + 2*v*v + w*w - 2*w*v) / (2 * a * v)
	}

	d1 := l - d

	s := (v*v - v1*v1) / (2 * a)

	if s >= d1 {
		t2 = (math.Sqrt(2*a*d1+v1*v1) - v1) / a
	} else {
		t2 = (v-v1)/a + (d1-s)/v
	}
	fmt.Printf("%f", t1+t2)
}

package main

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

var debug bool = false

func solve() {
	a := float64(readInt()) // acceleration of car
	v := float64(readInt()) // maximum velocity of car
	l := float64(readInt()) // total length of road
	d := float64(readInt()) // distance from beginning of limit
	w := float64(readInt()) // instantaneous speed limit

	if v < w {
		// If maximum velocity of car < speed limit, we
		// accelerate to maximum speed of car and travel
		// the rest of the way at that speed... or we
		// accelerate the whole way (never reaching max)
		fmt.Println(lastSection(a, v, l, 0.0))
		return
	}

	// time to reach 'd' at full acceleration
	td := math.Sqrt(2.0 * (d / a))

	// velocity at 'd' from full acceleration
	vd := a * td

	if debug {
		fmt.Println("full a td", td, "vd", vd)
	}

	if vd <= w {
		// At full acceleration, we we haven't reached the
		// limit, this is the same simple case as above
		fmt.Println(lastSection(a, v, l, 0.0))
		return
	}

	// Now, we know we can actually reach 'w' before we get to 'd'.
	// So, if we go flat out 'a' from 0 will we reach 'v' before we
	// have to start decelerating to be at 'w' by 'd'.
	//
	// Now we need to figure out whether we accelerate up to 'v',
	// cruise at v for awhile, then decelerate to 'w' OR we accelerate
	// as much as possible then decelerate to 'w'.

	// For now let's assume we'll accelerate and decelerate only
	// (no time spent at 'v').

	t_a := math.Sqrt((d / a) + math.Pow(w, 2.0)/(2.0*math.Pow(a, 2.0)))
	t_d := t_a - w/a
	t := t_a + t_d

	v_i := a * t_a

	if debug {
		fmt.Println("a", a, "l", l, "v", v, "d", d, "w", w)
		fmt.Println("vi", v_i, "ta", t_a, "td", t_d)

		fmt.Println("d_a", 0.5*a*t_a*t_a)
		fmt.Println("d_d", 0.5*(w+v_i)*t_d)
	}

	if v_i > v {
		// We have to spend some time cruising at 'v'
		t_a = v / a
		t_d = (v - w) / a

		if debug {
			fmt.Println("ta", t_a, "td", td)
		}
		dl := d
		dl -= 0.5 * v * t_a
		dl -= 0.5 * t_d * (v - w)
		t_v := dl / v
		t = t_a + t_d + t_v
	}

	if debug {
		fmt.Println("T", t)
	}

	l -= d

	fmt.Println(t + lastSection(a, v, l, w))
}

func lastSection(a, v, l, v0 float64) float64 {
	// simple case, either we accelerate all the way
	// (if we hit v after l), or we hit v and travel
	// the rest of the way at constant velocity 'v'

	// Can we just accelerate to the end? (staying under 'v')
	vend := math.Sqrt(v0*v0 + 2.0*a*l)
	if vend <= v {
		// we reach the end before 'v' matters
		return l / (0.5 * (vend + v0))
	}

	tv := (v - v0) / a // time to reach v (from v0)

	// take away distance covered accelerating to 'v'
	l -= 0.5 * a * tv * tv

	// How long to to cover the remaining distance?
	tl := l / v

	// result is sum of the two
	return (tv + tl)
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

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

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}


package main

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

func solve() {
	n := readInt()
	v := readIntArray(n)
	t := readIntArray(n)
	a := make([]int64, n)
	acc := int64(0)
	for i := 0; i < n; i++ {
		a[i] = int64(v[i]) + acc
		acc += int64(t[i])
	}
	sort.Sort(Int64(a))
	acc = 0
	start := 0
	cnt := 0
	for i := 0; i < n; i++ {
		total := int64(0)
		prev := acc
		acc += int64(t[i])
		cnt++
		for j := start; j < n; j++ {
			if acc > a[j] {
				total += a[j] - prev
				cnt--
				start = j + 1
			} else {
				break
			}
		}
		total += int64(cnt) * int64(t[i])
		if i > 0 {
			fmt.Print(" ")
		}
		fmt.Print(total)
	}
	fmt.Println()
}

type Int64 []int64

func (a Int64) Len() int           { return len(a) }
func (a Int64) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a Int64) Less(i, j int) bool { return a[i] < a[j] }

func solveBak() {
	n := readInt()
	v := readIntArray(n)
	t := readIntArray(n)
	heap := NewMinHeap(n)
	acc := int64(0)
	for i := 0; i < n; i++ {
		total := int64(0)
		cur := int64(t[i])
		heap.Add(i, int64(v[i])+acc)
		acc += cur
		for heap.Min() < acc {
			val := heap.Min()
			t1 := int64(val) - acc + cur
			total += t1
			heap.Remove(heap.ArgMin())
		}
		total += int64(heap.Size()) * cur
		if i > 0 {
			fmt.Print(" ")
		}
		fmt.Print(total)
	}
	fmt.Println()
}

type MinHeap struct {
	a    []int64
	vmap []int
	imap []int
	n    int
	pos  int
}

const INF = math.MaxInt32

func NewMinHeap(m int) *MinHeap {
	heap := &MinHeap{}
	m += 2
	heap.n = m
	heap.a = make([]int64, heap.n)
	heap.vmap = make([]int, heap.n)
	heap.imap = make([]int, heap.n)
	heap.pos = 1
	for i := 0; i < heap.n; i++ {
		heap.a[i] = INF
		heap.vmap[i] = -1
		heap.imap[i] = -1
	}
	return heap
}

func (h *MinHeap) Add(ind int, x int64) int64 {
	ret := h.imap[ind]
	if h.imap[ind] < 0 {
		h.a[h.pos] = x
		h.vmap[h.pos] = ind
		h.imap[ind] = h.pos
		h.pos++
		h.up(h.pos - 1)
	}
	if ret != -1 {
		return h.a[ret]
	}
	return x
}

func (h *MinHeap) Update(ind int, x int64) int64 {
	ret := h.imap[ind]
	if h.imap[ind] < 0 {
		h.a[h.pos] = x
		h.vmap[h.pos] = ind
		h.imap[ind] = h.pos
		h.pos++
		h.up(h.pos - 1)
	} else {
		h.a[ret] = x
		h.up(ret)
		h.down(ret)
	}
	return x
}

func (h *MinHeap) Remove(ind int) int64 {
	if h.pos == 1 {
		return INF
	}
	if h.imap[ind] == -1 {
		return INF
	}

	h.pos--
	rem := h.imap[ind]
	ret := h.a[rem]
	h.vmap[rem] = h.vmap[h.pos]
	h.imap[h.vmap[h.pos]] = rem
	h.imap[ind] = -1
	h.a[rem] = h.a[h.pos]
	h.a[h.pos] = INF
	h.vmap[h.pos] = -1

	h.up(rem)
	h.down(rem)
	return ret
}

func (h *MinHeap) Min() int64 {
	return h.a[1]
}

func (h *MinHeap) ArgMin() int {
	return h.vmap[1]
}

func (h *MinHeap) Size() int {
	return h.pos - 1
}

func (h *MinHeap) up(cur int) {
	for c, p := cur, cur>>1; p >= 1 && h.a[p] > h.a[c]; c, p = c>>1, p>>1 {
		h.a[p], h.a[c] = h.a[c], h.a[p]
		h.imap[h.vmap[p]], h.imap[h.vmap[c]] = h.imap[h.vmap[c]], h.imap[h.vmap[p]]
		h.vmap[p], h.vmap[c] = h.vmap[c], h.vmap[p]
	}
}

func (h *MinHeap) down(cur int) {
	for c := cur; 2*c < h.pos; {
		b := 0
		if h.a[2*c] < h.a[2*c+1] {
			b = 2 * c
		} else {
			b = 2*c + 1
		}
		if h.a[b] < h.a[c] {
			h.a[c], h.a[b] = h.a[b], h.a[c]
			h.imap[h.vmap[c]], h.imap[h.vmap[b]] = h.imap[h.vmap[b]], h.imap[h.vmap[c]]
			h.vmap[c], h.vmap[b] = h.vmap[b], h.vmap[c]
			c = b
		} else {
			break
		}
	}
}

func abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

// IO

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

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

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

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

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

// 这段代码演示了如何使用堆接口构建一个整数堆。
package main

import (
	"bufio"
	"container/heap"
"fmt"
	"os"
)

// IntHeap 是一个由整数组成的最小堆。
type IntHeap []int64

func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] < h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push 和 Pop 使用 pointer receiver 作为参数，
	// 因为它们不仅会对切片的内容进行调整，还会修改切片的长度。
	*h = append(*h, x.(int64))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

// 这个示例会将一些整数插入到堆里面， 接着检查堆中的最小值，
// 之后按顺序从堆里面移除各个整数。
func main() {
	in := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(in, &n)
	var v[100010] int64
	var t[100010] int64
	for i := 1; i<= n; i++{
		fmt.Fscan(in, &v[i])
	}
	for i := 1; i<= n; i++{
		fmt.Fscan(in, &t[i])
	}
	h := &IntHeap{}
	heap.Init(h)

	var totalT,totalQ int64
	totalT = 0
	for i := 1; i <= n; i++{
		heap.Push(h, v[i] + totalT)
		totalQ = totalT
		totalT = totalT + t[i]
		var tmp int64
		tmp = 0
		for ;;{
			if 0 == len(*h){
				break
			}
			if (*h)[0] <= totalT {
				tmp += (*h)[0] - totalQ
				//fmt.Println(i, tmp, (*h)[0])
				heap.Pop(h)
			}else{
				break
			}
		}
		tmp =tmp + t[i] * (int64)(len(*h))
		fmt.Printf("%d", tmp)
		if i == n{
			fmt.Println()
		}else{
			fmt.Print(" ")
		}
	}

}

package main

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

func solve() {
	n := readInt()
	v := readIntArray(n)
	t := readIntArray(n)
	a := make([]int64, n)
	acc := int64(0)
	for i := 0; i < n; i++ {
		a[i] = int64(v[i]) + acc
		acc += int64(t[i])
	}
	sort.Sort(Int64(a))
	acc = 0
	start := 0
	cnt := 0
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		total := int64(0)
		prev := acc
		acc += int64(t[i])
		cnt++
		for j := start; j < n; j++ {
			if acc > a[j] {
				total += a[j] - prev
				cnt--
				start = j + 1
			} else {
				break
			}
		}
		total += int64(cnt) * int64(t[i])
		res[i] = total
	}
	b10 := []byte("")
	for i, v := range res {
		if i > 0 {
			b10 = append(b10, ' ')
		}
		b10 = strconv.AppendInt(b10, v, 10)
	}
	fmt.Println(string(b10))
}

type Int64 []int64

func (a Int64) Len() int           { return len(a) }
func (a Int64) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a Int64) Less(i, j int) bool { return a[i] < a[j] }

func solveBak() {
	n := readInt()
	v := readIntArray(n)
	t := readIntArray(n)
	heap := NewMinHeap(n)
	acc := int64(0)
	for i := 0; i < n; i++ {
		total := int64(0)
		cur := int64(t[i])
		heap.Add(i, int64(v[i])+acc)
		acc += cur
		for heap.Min() < acc {
			val := heap.Min()
			t1 := int64(val) - acc + cur
			total += t1
			heap.Remove(heap.ArgMin())
		}
		total += int64(heap.Size()) * cur
		if i > 0 {
			fmt.Print(" ")
		}
		fmt.Print(total)
	}
	fmt.Println()
}

type MinHeap struct {
	a    []int64
	vmap []int
	imap []int
	n    int
	pos  int
}

const INF = math.MaxInt32

func NewMinHeap(m int) *MinHeap {
	heap := &MinHeap{}
	m += 2
	heap.n = m
	heap.a = make([]int64, heap.n)
	heap.vmap = make([]int, heap.n)
	heap.imap = make([]int, heap.n)
	heap.pos = 1
	for i := 0; i < heap.n; i++ {
		heap.a[i] = INF
		heap.vmap[i] = -1
		heap.imap[i] = -1
	}
	return heap
}

func (h *MinHeap) Add(ind int, x int64) int64 {
	ret := h.imap[ind]
	if h.imap[ind] < 0 {
		h.a[h.pos] = x
		h.vmap[h.pos] = ind
		h.imap[ind] = h.pos
		h.pos++
		h.up(h.pos - 1)
	}
	if ret != -1 {
		return h.a[ret]
	}
	return x
}

func (h *MinHeap) Update(ind int, x int64) int64 {
	ret := h.imap[ind]
	if h.imap[ind] < 0 {
		h.a[h.pos] = x
		h.vmap[h.pos] = ind
		h.imap[ind] = h.pos
		h.pos++
		h.up(h.pos - 1)
	} else {
		h.a[ret] = x
		h.up(ret)
		h.down(ret)
	}
	return x
}

func (h *MinHeap) Remove(ind int) int64 {
	if h.pos == 1 {
		return INF
	}
	if h.imap[ind] == -1 {
		return INF
	}

	h.pos--
	rem := h.imap[ind]
	ret := h.a[rem]
	h.vmap[rem] = h.vmap[h.pos]
	h.imap[h.vmap[h.pos]] = rem
	h.imap[ind] = -1
	h.a[rem] = h.a[h.pos]
	h.a[h.pos] = INF
	h.vmap[h.pos] = -1

	h.up(rem)
	h.down(rem)
	return ret
}

func (h *MinHeap) Min() int64 {
	return h.a[1]
}

func (h *MinHeap) ArgMin() int {
	return h.vmap[1]
}

func (h *MinHeap) Size() int {
	return h.pos - 1
}

func (h *MinHeap) up(cur int) {
	for c, p := cur, cur>>1; p >= 1 && h.a[p] > h.a[c]; c, p = c>>1, p>>1 {
		h.a[p], h.a[c] = h.a[c], h.a[p]
		h.imap[h.vmap[p]], h.imap[h.vmap[c]] = h.imap[h.vmap[c]], h.imap[h.vmap[p]]
		h.vmap[p], h.vmap[c] = h.vmap[c], h.vmap[p]
	}
}

func (h *MinHeap) down(cur int) {
	for c := cur; 2*c < h.pos; {
		b := 0
		if h.a[2*c] < h.a[2*c+1] {
			b = 2 * c
		} else {
			b = 2*c + 1
		}
		if h.a[b] < h.a[c] {
			h.a[c], h.a[b] = h.a[b], h.a[c]
			h.imap[h.vmap[c]], h.imap[h.vmap[b]] = h.imap[h.vmap[b]], h.imap[h.vmap[c]]
			h.vmap[c], h.vmap[b] = h.vmap[b], h.vmap[c]
			c = b
		} else {
			break
		}
	}
}

func abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

// IO

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

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

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

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

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

package main

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

func solve() {
	n := readInt()
	v := readIntArray(n)
	t := readIntArray(n)
	a := make([]int64, n)
	acc := int64(0)
	for i := 0; i < n; i++ {
		a[i] = int64(v[i]) + acc
		acc += int64(t[i])
	}
	sort.Sort(Int64(a))
	acc = 0
	start := 0
	cnt := 0
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		total := int64(0)
		prev := acc
		acc += int64(t[i])
		cnt++
		for j := start; j < n; j++ {
			if acc > a[j] {
				total += a[j] - prev
				cnt--
				start = j + 1
			} else {
				break
			}
		}
		total += int64(cnt) * int64(t[i])
		res[i] = total
	}
	// b10 := []byte("")
	// for i, v := range res {
	// 	if i > 0 {
	// 		b10 = append(b10, ' ')
	// 	}
	// 	b10 = strconv.AppendInt(b10, v, 10)
	// }
	// fmt.Println(string(b10))
	w := bufio.NewWriter(os.Stdout)
	for i, v := range res {
		if i > 0 {
			fmt.Fprint(w, " ")
		}
		fmt.Fprint(w, strconv.FormatInt(v, 10))
	}
	w.Flush() // Don't forget to flush!
}

type Int64 []int64

func (a Int64) Len() int           { return len(a) }
func (a Int64) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a Int64) Less(i, j int) bool { return a[i] < a[j] }

func abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

// IO

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

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

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

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

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


package main

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

func main() {
	var n int
	if _, err := fmt.Scanf("%d\n", &n); err != nil {
		return
	}

	var eo [2]int

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; i < n && scanner.Scan(); i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			return
		}
		eo[a%2] += 1
	}

	if eo[1]%2 == 0 {
		fmt.Println(eo[0])
	} else {
		fmt.Println(eo[1])
	}
}

package main

import (
	"fmt"
)

func main() {
	var n, s, ans, f int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
		s += a[i]
	}

	for i := 0; i < n; i++ {
		if (s-a[i])%2 == 0 {
			ans++
		}
	}

	fmt.Println(ans)
	fmt.Scan(&f)
}

package main

import (
	"fmt"
)

func main() {
	var n, cnt, sum int
	fmt.Scan(&n)
	a := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
		sum += a[i]
	}
	for i := 0; i < n; i++ {
		if (sum-a[i])%2 == 0 {
			cnt += 1
		}
	}
	fmt.Println(cnt)
}

package main
import (
	"fmt"
	//"unicode/utf8"
	//"strconv"
)

func main() {
	var n int
	x:=make([]int,105)
	k,l:=0,0
	fmt.Scan(&n)
	for i:=0;i<n;i++ {
		fmt.Scan(&x[i])
		k+=x[i]
	}
	for i:=0;i<n;i++ {
			if (k-x[i])%2==0 {
				l++
			}
	}
	fmt.Println(l)
}

package main

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

var scanner *bufio.Scanner

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func getI() int {
  return int(getI64())
}
func getF() float64 {
  scanner.Scan()
  x, _ := strconv.ParseFloat(scanner.Text(), 64)
  return x
}
func getS() string {
  scanner.Scan()
  return scanner.Text()
}

func main() {
  scanner = bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer := bufio.NewWriter(os.Stdout)
  defer writer.Flush()

  n := getI()
  even := 0
  for i := 0; i < n; i++ {
    if getI()%2 == 0 {
      even++
    }
  }
  odd := n - even
  result := even
  if odd%2 == 1 {
    result = odd
  }
  writer.WriteString(fmt.Sprintf("%d\n", result))
}

package main

import "fmt"

func main() {
    var n int
    var a [105]int
    ans, total := 0, 0
    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        fmt.Scan(&a[i])
        total += a[i]
    }
    for i := 0; i < n; i++ {
        if (total-a[i]) % 2 == 0 { ans++ }
    }
    fmt.Println(ans)
}

//http://codeforces.com/contest/129/problem/A
package main

import (
	"fmt"
	"log"
)

func main() {
	var n int
	_, err := fmt.Scan(&n)
	if err != nil {
		log.Fatal(err)
	} else {
		cookiesInBags := make([]int, n)
		totalCookies := 0
		for i := 0; i < n; i++ {
			_, err := fmt.Scan(&cookiesInBags[i])
			if err == nil {
				totalCookies += cookiesInBags[i]
			}
		}
		fmt.Println(countWays(cookiesInBags, totalCookies))
	}
}

func countWays(cookiesInBags []int, totalCookies int) int {
	isEven := false
	if totalCookies%2 == 0 {
		isEven = true
	}
	res := 0

	if isEven {
		evenCount := 0
		for i := 0; i < len(cookiesInBags); i++ {
			currentNumber := cookiesInBags[i]
			if currentNumber%2 == 0 {
				evenCount++
			}
		}
		res = evenCount
	} else {
		oddCount := 0
		for i := 0; i < len(cookiesInBags); i++ {
			currentNumber := cookiesInBags[i]
			if currentNumber%2 != 0 {
				oddCount++
			}
		}
		res = oddCount
	}

	return res
}

// 129A
package main

import (
	"fmt"
)

func main() {
	var n, a int
	o, e := 0, 0
	fmt.Scan(&n)
	for i := o; i < n; i++ {
		fmt.Scan(&a)
		if a%2 == 0 {
			e++
		} else {
			o++
		}
	}
	if o%2 == 0 {
		fmt.Println(e)
	} else {
		fmt.Println(o)
	}

}

// 129A-mic
package main

import (
    "fmt"
)

func main() {
    var n, s, o, e int
    fmt.Scan(&n)
    a := make([]int, n)
    for i := 0; i < n; i++ {
        fmt.Scan(&a[i])
        s += a[i]
        if a[i]%2 == 0 {
            e++
        } else {
            o++
        }
    }
    if s%2 == 0 {
        fmt.Println(e)
    } else {
        fmt.Println(o)
    }

}


package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func gcd(a,b int64) int64{
	if(a==0 || b==0){
		return a+b
	}
	return gcd(b,a%b)
}

// Credits - github.com/EndlessCheng/codeforces-go
func solve(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	T:= 0
	for Fscan(in, &T); T > 0; T-- {
		var m,d,w,ans int64
		Fscan(in, &m,&d,&w);
		if m>d{
			m=d
		}
		d--
		if d%w==0{
			Fprintln(out,m*(m-1)/2)
			continue
		}
		d=w/gcd(d,w)
		ans+=m*(m/d)
		m/=d
		ans-=(m*(m+1)/2)*d
		Fprintln(out,ans)
	}
}

func main() { solve(os.Stdin, os.Stdout) }

package main

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

func main() {
	io := newFastIO(os.Stdin, os.Stdout)
	defer io.Flush()

	var gcd func(i, j int) int
	gcd = func(i, j int) int {
		if j == 0 {
			return i
		}
		return gcd(j, i%j)
	}

	for t := io.nextInt(); t > 0; t-- {
		m, d, w := io.nextInt(), io.nextInt(), io.nextInt()
		g := gcd(d-1, w)
		w /= g
		n := d
		if n > m {
			n = m
		}
		q, r := int64(n/w), int64(n%w)
		ans := q*(q-1)/2*(int64(w)-r) + q*(q+1)/2*r
		io.println(ans)
	}
}

type fastIO struct {
	*bufio.Reader
	*bufio.Writer
	p [1]byte
}

func newFastIO(r io.Reader, w io.Writer) *fastIO {
	return &fastIO{Reader: bufio.NewReader(r), Writer: bufio.NewWriter(w)}
}

func (f *fastIO) nextInt() int {
	f.Read(f.p[:])
	for f.p[0] <= ' ' {
		f.Read(f.p[:])
	}
	neg := false
	if f.p[0] == '-' {
		neg = true
		f.Read(f.p[:])
	}
	n := 0
	for '0' <= f.p[0] && f.p[0] <= '9' {
		n = n*10 + int(f.p[0]) - '0'
		f.Read(f.p[:])
	}
	if neg {
		return -n
	}
	return n
}

func (f *fastIO) nextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.nextInt()
	}
	return a
}

func (f *fastIO) next() string {
	f.Read(f.p[:])
	for f.p[0] <= ' ' {
		f.Read(f.p[:])
	}
	var s []byte
	for f.p[0] > ' ' {
		s = append(s, f.p[0])
		f.Read(f.p[:])
	}
	return string(s)
}

func (f *fastIO) println(a ...interface{}) {
	fmt.Fprintln(f.Writer, a...)
}

func (f *fastIO) print(a ...interface{}) {
	fmt.Fprint(f.Writer, a...)
}

func (f *fastIO) printInts(a ...int) {
	if len(a) > 0 {
		f.print(a[0])
		for _, x := range a[1:] {
			f.print(" ", x)
		}
	}
}

func (f *fastIO) printlnInts(a ...int) {
	f.printInts(a...)
	f.println()
}


package main

import "fmt"

func FoodBuying(s int) int {
	rs := s
	for ; s >= 10; {
		d := s % 10
		n := s / 10
		rs += n
		s = n +d
	}
	return rs
}

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var s int
		fmt.Scanf("%d\n", &s)
		fmt.Println(FoodBuying(s))
	}
}

package main

import "fmt"

func sum(a int,b int) int {

	b+=a/10

	if a/10<1 {
		return b
	}
	return sum(a/10+a%10,b)
}

func main(){
	var x int
	var y int
	fmt.Scanln(&y)
	for i:=0;i<y;i++{
	    fmt.Scanln(&x)
	    fmt.Println(sum(x,0)+x)
	}

}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin);
	out := bufio.NewWriter(os.Stdout);
	var t int;
	fmt.Fscan(in, &t);
	for i := 0; i < t; i++ {
		s, ans := 0, 0;
		fmt.Fscan(in, &s);
		for ; s / 10 > 0; s -= (s / 10)*10 - s / 10 {
			ans += (s/10)*10;
		}
		ans += s;
		fmt.Fprintln(out, ans);
	}
	out.Flush();
}

package main

import "fmt"

func main() {
	var t uint
	fmt.Scan(&t)

	for t > 0 {
		var a uint
		fmt.Scan(&a)
		sum := a
		for a >= 10 {
			sum += a / 10
			a = (a / 10) + (a % 10)
		}
		fmt.Println(sum)
		t--
	}
}

package main

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

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	s.Buffer(make([]byte, 1<<12), 1<<20)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	s.Scan()
	t, _ := strconv.Atoi(s.Text())

	for i := 0; i < t; i++ {
		s.Scan()
		n, _ := strconv.Atoi(s.Text())
		k := 0
		for n >= 10 {
			k += (n / 10) * 10
			n = n/10 + n%10
		}
		k += n
		fmt.Fprintln(w, k)
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int

	fmt.Scanln(&t)

	for i := 0; i < t; i++ {
		var s, max uint64
		fmt.Scanln(&s)

		max = s
		for {
			remain := s % 10
			s = s / 10
			max += s
			if s == 0 {
				break
			}

			s += remain
		}

		fmt.Println(max)
	}
}

package main

import "fmt"

var (
	t int
)

func main() {
	fmt.Scan(&t)
	for cnt := 1; cnt <= t; cnt++ {
		var s, ans, tmp int
		fmt.Scan(&s)
		tmp = s
		for {
			var refound, yu = tmp / 10, tmp % 10
			ans += refound * 10
			if tmp < 10 {
				ans += tmp
				break
			}
			tmp = refound + yu
		}
		fmt.Println(ans)
	}
}

package main

import "fmt"

func buyFood(t int) int {
	for t > 0 {
		var s int
		fmt.Scan(&s)
		ans := 0
		pw := 1000 * 1000 * 1000
		for s > 0{
			for s < pw {
				pw /= 10
			}
			ans += pw
			s -= pw - pw / 10
		}
		fmt.Println(ans)
		t--
	}
	return 0
}

func main() {
	var t int
	fmt.Scan(&t)
	buyFood(t)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
// 9876 = 9870 + 987 + 6 = 9870 + 990 + 3 = 9870 + 990 + 99 + 3 = 9870 + 990 + 100 + 10 + 3 =
func main() {
	scanner := bufio.NewScanner(os.Stdin)
	cases := getIntFromInput(scanner)
	for i:=int64(0);i<cases;i++ {
		num := getIntFromInput(scanner)
		result := int64(0)
		for num / 10 > 0 {
			left := num % 10
			i := num / 10
			result += i * 10
			num = left + i
		}
		result += num
		fmt.Println(result)
	}

}

func getIntFromInput(s *bufio.Scanner) int64 {
	s.Scan()
	numStr := s.Text()
	num,_ := strconv.ParseInt(numStr, 10, 64)
	return num
}

package main

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

//•*¨*•.¸¸♪I/O•*¨*•.¸¸♪

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

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

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

func scanFloat64() float64 {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return float64(a)
}

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

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//•*¨*•.¸¸♪func(int)•*¨*•.¸¸♪
func abs(a int) int { if a<0 { return -a }; return a }
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 }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Buffer(make([]byte, 10000), 100000000)

	in := scanInt()

	for t := 0; t < in; t++ {
		s := scanInt64()
		ans := s

		for s != 0 {
			x := int64(1)
			for s/x/10 != 0 {
				x *= 10
			}

			ans += (s/x)*(x/10)
			s = s%x + (s/x)*(x/10)
		}

		fmt.Println(ans)
	}
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var t int
	fmt.Fscanf(reader, "%d\n", &t)
	for i := 0; i < t; i++ {
		var s int64
		fmt.Fscanf(reader, "%d\n", &s)

		ans := s
		for s > 0 {
			ans += s / 10
			if s >= 10 {
				s = (s % 10) + (s / 10)
			} else {
				s = 0
			}
		}

		fmt.Fprintf(writer, "%d\n", ans)
	}
}

package main

import (
	"fmt"
)

func main() {
	t := 0
	fmt.Scanln(&t)
	for i := 0; i < t; i++ {
		s := int64(0)
		fmt.Scanln(&s)
		s1 := s
		for s >= 10 {
			cb := s / 10
			s  = s % 10 + cb
			s1 += cb
		}
		fmt.Println(s1)
	}
}

// https://serhatgiydiren.github.io

package main

import "fmt"
import "os"
import "bufio"

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func solve(test_id int) {
 var n int
 res := 0
 fmt.Fscanf(reader, "%d\n", &n)
 for ; n > 9 ; {
  val := n - n % 10
  res += val
  n = val / 10 + n % 10
 }
 fmt.Fprintf(writer,"%d\n", n + res)
}

func solve_cases() {
 defer writer.Flush()
 t := 1
 fmt.Fscanf(reader, "%d\n", &t)
 for i := 0 ; i < t ; i++ {
  solve(i)
 }
}

func main() {
 solve_cases()
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

func solve() {
	var n int64
	scanf("%d\n", &n)
	var ans int64
	for n > 9 {
		ans += n - n % 10
		n = n / 10 + n % 10
	}
	ans += n
	printf("%d\n", ans)
}

func main() {
	t := 1
	scanf("%d\n", &t)
	for t > 0 {
		 solve()
		 t--
	}
	writer.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	for testCase := scanInt(); testCase > 0; testCase--{
		n := scanInt()
		answer := 0

		for n >= 10{
			answer += n - n % 10
			n = n % 10 + n / 10
		}
		answer += n
		printFmt(answer)
	}
	close(channelType)
	oWg.Wait()
}

/*********************** I/O ***********************/

var channelType chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var printFmt func(a ...interface{}) (n int, err error)

func init() {
	printFmt = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	channelType = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range channelType {
			writer.WriteString(line + "\n")
		}
	}()
}

func scanString() string {in.Scan(); return in.Text() }
func scanInt() int {i, _ := strconv.Atoi(scanString()); return i}
func scanInt64() int64 {i, _ := strconv.ParseInt(scanString(), 10, 64); return i}
func scanStringSlice(n int) []string {s := make([]string, n); for i := 0; i < n; i++ {s[i] = scanString()}; return s}
func scanIntSlice(n int) []int {arr := make([]int, n); for i := 0; i < n; i++ {arr[i] = scanInt()}; return arr}
func scanInt64Slice(n int) []int64 {arr := make([]int64, n); for i := 0; i < n; i++ {arr[i] = scanInt64()}; return arr}

/*********************** Utils ***********************/

func stringEquivalent(v interface{}) string {return fmt.Sprintf("%v", v)}
func spaceSeperatedStringFromArray(a []int) string {sb := strings.Builder{}; sb.Grow(len(a) * 9); for i := range a {sb.WriteString(strconv.Itoa(a[i]) + " ")}; return sb.String()}
func spaceSeperatedStringFromArray64(a []int64) string {sb := strings.Builder{}; sb.Grow(len(a) * 9); for i := range a {sb.WriteString(strconv.FormatInt(a[i], 10) + " ")}; return sb.String()}
func minMaxFromArray(args ...int64) (int64, int64) {minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64); for _, v := range args {if v < minVal {minVal = v}; if v > maxVal {maxVal = v}}; return minVal, maxVal}
func minElementFromArray(args ...int64) int64 { mn, _ := minMaxFromArray(args...); return mn }
func maxElementFromArray(args ...int64) int64 { _, mx := minMaxFromArray(args...); return mx }
func lcmCalculation(a, b int64) int64 {return a / gcdCalculation(a, b) * b}
func gcdCalculation(a, b int64) int64 {if (a == 0) {return b}; return gcdCalculation(b%a, a)}
func sortInt64Slice(a []int64) {sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })}
func absoluteValue(x int64) int64 {if x < 0 {return -x}; return x}
func min(args ...int) int { mn, _ := minMaxFinder(args...); return mn }
func max(args ...int) int { _, mx := minMaxFinder(args...); return mx }
func minMaxFinder(args ...int) (int, int) { minVal, maxVal := int(math.MaxInt32), int(math.MinInt32); for _, v := range args { if v < minVal { minVal = v }; if v > maxVal { maxVal = v } }; return minVal, maxVal }

package main

import "fmt"

func sum(a int,b int) int {

	b+=a/10

	if a/10<1 {
		return b
	}
	return sum(a/10+a%10,b)
}

func main(){
	var x int
	var y int
	var s []int
	fmt.Scanf("%d",&y)
	s = make([]int, y,y)

	for i:=0;i<y;i++{
	    fmt.Scanln()
		fmt.Scanf("%d",&x)
		s[i]=x
	}
	for i:=0;i<y;i++{
		fmt.Println(sum(s[i],0)+s[i])
	}
}

package main

import "fmt"

var (
	t int
)

func main() {
	fmt.Scan(&t)
	for cnt := 1; cnt <= t; cnt++ {
		var ans, tmp int
		fmt.Scan(&ans)
		tmp = ans
		for tmp != 0 {
			var refound, yu = tmp / 10, tmp % 10
			if yu >= 5 && refound != 0 {
				ans++
			}
			ans += refound
			tmp = refound
		}
		fmt.Println(ans)
	}
}

package main

import "fmt"

func sum(a int,b int) int {

	b+=a/10

	if a/10<1 {
		return b
	}
	return sum(a/10+a%10,b)
}

func main(){
	var x int
	var y int
	var s []int
	fmt.Scanf("%d",&y)
	s = make([]int, y)

	for i:=0;i<y;i++{
		fmt.Scanf("%d",&x)

		s[i]=x
	}
	for i:=0;i<y;i++{
		fmt.Println(sum(s[i],0)+s[i])
	}
}

package main

import "fmt"

func sum(a int,b int) int {

	b+=a/10

	if a/10<1 {
		return b
	}
	return sum(a/10+a%10,b)
}

func main(){
	var x int
	var y int
	fmt.Scanf("%d,%d",&y,&y)

	for i:=0;i<y;i++{
		fmt.Println(sum(x,0)+x)
	}
}

package main

import "fmt"

func sum(a int,b int) int {

	b+=a/10

	if a/10<1 {
		return b
	}
	return sum(a/10+a%10,b)
}

func main(){
	var x int
	var y int
	fmt.Scanf("%d",&y)

	for i:=0;i<y;i++{
		fmt.Scanf("%d",&x)
		fmt.Println(sum(x,0)+x)
	}
}

package main

import "fmt"

func sum(a int,b int) int {

	b+=a/10

	if a/10<1 {
		return b
	}
	return sum(a/10+a%10,b)
}

func main(){
	var x int
	var y int
	fmt.Scanf("%d,%d",&y,&y)

	for i:=0;i<6;i++{
		fmt.Println(sum(x,0)+x)
	}
}

package main

import "fmt"

func sum(a []int) string {
	var sum int

	for index:=0;index<len(a);index++{
		sum+=a[index]
	}
	if sum%2==1 {
		return "YES"
	}

	if sum%2==0{
		for m:=0;m<len(a);m++{
			for n:=m+1; n<len(a);n++{
				if (a[m]+a[n])%2==1 {
					return "YES"
				}
			}
		}
	}

	return "NO"
}

func main(){
	var x int
	var n int

	fmt.Scan(&n)
	for i:=0;i<n;i++{
		fmt.Scan(&x)
		var list = make([]int,x,x)
		for i:=0;i<x;i++ {
			fmt.Scan(&list[i])
		}
		fmt.Println(sum(list))
	}
}

package main

import "fmt"

func sum(a int,b int) int {

	b+=a/10

	if a/10<1 {
		return b
	}
	return sum(a/10+a%10,b)
}

func main(){
	var x int
	fmt.Scanf("%d",&x)
	fmt.Println(sum(x,0)+x)

}


package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var s string
		fmt.Fscan(in, &s)

		m := make([]bool, 26)
		var tot int64
		var pos int
		for i, ch := range s {
			if !m[ch-'a'] {
				m[ch-'a'] = true
			} else {
				tot += int64((i - pos) - 1)
				pos = i + 1
				m = make([]bool, 26)
			}
		}

		for _, v := range m {
			if v {
				tot++
			}
		}

		fmt.Fprintln(out, tot)
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	defer out.Flush()
	var t int
	fmt.Fscanf(in, "%d\n", &t)
	for t := t; t > 0; t-- {
		var s string
		fmt.Fscanf(in, "%s\n", &s)
		s = "#" + s
		n := len(s)
		d := make([]int, n)
		m := make(map[uint8]int)
		for i := 1; i < n; i++ {
			j := m[s[i]]
			d[i] = d[i-1] + 1
			if j > 0 {
				k := i - j - 1 + d[j-1]
				if k < d[i] {
					d[i] = k
				}
			}
			m[s[i]] = i
		}
		fmt.Fprintln(out, d[n-1])
	}
}

package main

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

func main() {
	in, out := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ii := 0; ii < t; ii++ {
		var s string
		fmt.Fscan(in, &s)
		dp := make([]int, len(s)+1)
		dic := [26]int{}
		for i := 0; i < 26; i++ {
			dic[i] = -1
		}
		for i := 0; i < len(s); i++ {
			dp[i+1] = dp[i] + 1
			if last := dic[s[i]-'a']; last != -1 {
				dp[i+1] = min(dp[i+1], dp[last]+i-last-1)
			}
			dic[s[i]-'a'] = i
		}
		fmt.Fprintln(out, dp[len(s)])

	}
}

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

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func main() {
	Cf1660(os.Stdin, os.Stdout)
}

func Cf1660(_r io.Reader, _w io.Writer) {
	in, out := bufio.NewReader(_r), bufio.NewWriter(_w)
	defer out.Flush()

	cases := 0
	Fscan(in, &cases)

	var str string
	var n int

	for ; cases > 0; cases-- {
		Fscan(in, &str)
		n = len(str)
		str = "!" + str
		dp := make([]int, n+1) //dp[i]表示 第i个元素需要满足even string最少需要remove的个数
		dp[0] = 0              //初始化dp，表示移除0个元素最少需要0次
		vis := make(map[byte]int)
		for i := 1; i <= n; i++ {
			if pos, ok := vis[str[i]]; !ok {
				dp[i] = dp[i-1] + 1
			} else {
				dp[i] = min(dp[i-1]+1, dp[pos-1]+(i-pos-1))
			}
			vis[str[i]] = i
		}
		Fprintf(out, "%d\n", dp[n])
	}
}

func min(i, j int) int {
	if i < j {
		return i
	}
	return j
}

package main

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

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

var in = bufio.NewReader(os.Stdin)

func solve(){
	var s string
	fmt.Fscan(in,&s)
	n:=len(s)
	s=" " + s
	dp:=make([]int,n+1)
	pos:=make([]int,26)

	// fmt.Print(s,n," ")
	for i:=1;i<=n;i++{
		dp[i]=dp[i-1] + 1
		l:=pos[s[i]-'a']
		if l>0 {
			dp[i]=min(dp[i],dp[l-1] + i - l - 1)
		}
		pos[s[i]-'a']=i;
	}

	fmt.Println(dp[n])
}
func main() {
	var tc int
    fmt.Scan(&tc)
	// fmt.Print(tc)
	for i:=0;i<tc;i++{
		solve()
	}
}

package main

import (
	"fmt"
	"strings"
)

// abcbd

// a != b
// a = 1
// b = 1
// c = 1
// b = 2

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

func cost(s string, from int, memo map[int]int) int {
	if from == (len(s) - 1) {
		return 1
	}
	if from >= len(s) {
		return 0
	}
	v, ok := memo[from]
	if ok {
		return v
	}
	if s[from] == s[from+1] {
		return cost(s, from+2, memo)
	}
	next := strings.Index(s[from+1:], string(s[from]))
	if next == -1 {
		return 1 + cost(s, from+1, memo)
	}

	dist := (next + from) - from
	resp := min(1+cost(s, from+1, memo), dist+cost(s, (next+from+2), memo))
	memo[from] = resp
	return resp
}
func main() {
	var testCases int
	fmt.Scanf("%d\n", &testCases)

	for i := 0; i < int(testCases); i++ {
		var s string
		fmt.Scanf("%s\n", &s)
		if len(s)%2 == 1 {

		}
		fmt.Println(cost(s, 0, make(map[int]int)))
	}
}

package main

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

/*
7
asdasd
abbbab
aabbccd
eaabbccd
abccba
aabbxxx
abbcca
---
4
2
1
2
4
1
2
--
*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var s string
	scanf("%s\n", &s)

	prev := make([]bool, 26)

	cnt := 0

	for _, r := range s {
		ord := int(r - 'a')

		if prev[ord] {
			for i := range prev {
				prev[i] = false
			}
			cnt += 2
		} else {
			prev[ord] = true
		}
	}

	fmt.Fprintln(writer, len(s)-cnt)
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

// https://codeforces.com/problemset/problem/1660/C

// 1660C - Get an Even String

// A string a=a1a2…an is called even if it consists of a concatenation (joining) of strings of length 2 consisting of the same characters. In other words, a string a is even if two conditions are satisfied at the same time:
//  • its length n is even;
//  • for all odd i (1≤i≤n−1), ai=ai+1 is satisfied.
// For example, the following strings are even: "" (empty string), "tt", "aabb", "oooo", and "ttrrrroouuuuuuuukk". The following strings are not even: "aaa", "abab" and "abba".
// Given a string s consisting of lowercase Latin letters. Find the minimum number of characters to remove from the string s to make it even. The deleted characters do not have to be consecutive.

// Input
// The first line of input data contains an integer t (1≤t≤10^4) —the number of test cases in the test.
// The descriptions of the test cases follow.
// Each test case consists of one string s (1≤|s|≤2⋅10^5), where |s| — the length of the string s. The string consists of lowercase Latin letters.
// It is guaranteed that the sum of |s| on all test cases does not exceed 2⋅10^5.

// Output
// For each test case, print a single number — the minimum number of characters that must be removed to make s even.

// Examples
// input
// 6
// aabbdabdccc
// zyx
// aaababbb
// aabbcc
// oaoaaaoo
// bmefbmuyw
// output
// 3
// 3
// 2
// 0
// 2
// 7

// Note

// In the first test case you can remove the characters with indices 6, 7, and 9 to get an even string "aabbddcc".
// In the second test case, each character occurs exactly once, so in order to get an even string, you must remove all characters from the string.
// In the third test case, you can get an even string "aaaabb" by removing, for example, 4-th and 6-th characters, or a string "aabbbb" by removing the 5-th character and any of the first three.

// Tutorial

// We will act greedily: we will make an array prev consisting of 26 elements, in which we will mark prev[i]=true if the letter is already encountered in the string, and prev[i]=false otherwise. In the variable m we will store the length of the even string that can be obtained from s. We will go through the string by executing the following algorithm:
//  • if prev[i]=false, mark prev[i]=true.
//  • if prev[i]=true, then we already have a pair of repeating characters to add to an even string — add 2 to the number m and clear the array used.
// Clearing prev is necessary because both characters that will make up the next pair must be in the s string after the current character. In other words, if the last character in the current pair was st, then the first character in the new pair can be sk, where t<k<n.
// Then we calculate the answer as n−m.

package main

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

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	var c int
	var t, m, n, i uint
	var s string
	var prev [26]bool
	var char rune

	for c, _ = fmt.Fscan(reader, &t); c == 1; c, _ = fmt.Fscan(reader, &t) {
		for ; t > 0; t-- {
			fmt.Fscan(reader, &s)
			m = 0
			n = uint(len(s))

			for i = 0; i < 26; i++ {
				prev[i] = false
			}

			for _, char = range s {
				if prev[char-'a'] {
					m += 2
					for i = 0; i < 26; i++ {
						prev[i] = false
					}
				} else {
					prev[char-'a'] = true
				}
			}

			fmt.Fprintln(writer, n-m)
		}
	}

	writer.Flush()
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func method(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var n int
	Fscan(in, &n)
	for ; n > 0; n-- {
		var s string
		Fscan(in, &s)
		maps := map[byte]int{}
		ans := 0
		for i := 0; i < len(s); i++ {
			indx := s[i]
			if maps[indx] != 0 {
				ans += len(maps) - 1
				maps = map[byte]int{}
			} else {
				maps[indx]++
			}
		}
		ans += len(maps)
		Fprintln(out, ans)
	}
}

func main() {
	method(os.Stdin, os.Stdout)
}

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

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

package main

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

func main() {
	run(os.Stdin, os.Stdout)
}

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)

	defer out.Flush()

	var T int
	var s string
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &s)
		tmpList := []byte(s)
		tmpMap := map[byte]bool{}
		tmpCount := 0
		for _, v := range tmpList {
			if tmpMap[v] {
				tmpCount--
				tmpMap = map[byte]bool{}
			} else {
				tmpMap[v] = true
				tmpCount++
			}
		}
		fmt.Fprintln(out, tmpCount)
	}
}

package main

// Problem description URL https://atcoder.jp/contests/abc236/tasks/abc240_a

import (
	"bufio"
	"container/list"
	"fmt"
	"os"
)

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func scan(a ...interface{})             { fmt.Fscan(in, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(out, f, a...) }

type pair struct {
	Color int
	Size  int
}

var (
	n   = 0
	t   = 0
	a []int
	res []int
	s   *list.List
	cur = 0
)

func solve() {
	scan(&t)
	for t != 0 {
		t--
		str := ""
		scan(&str)
		n = len(str)
		prev := make([]bool, 26)
		m := 0
		for _, c := range str {
			if prev[c - 'a'] {
				m += 2
				for i := 0; i < 26; i++ {
					prev[i] = false
				}
			} else {
				prev[c - 'a'] = true
			}
		}
		printf("%d\n", n - m)
	}
}

func main() {
	defer out.Flush()
	solve()
}

package main

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

const mod = 998244353
const mx = 3000

func solve(in *bufio.Reader, out *bufio.Writer) {
	defer out.Flush()
	var str string
	fmt.Fscan(in,&str)
	m := map[int32]int{}
	cnt := 0
	for _,v := range str{
		if m[v] == 1{
			cnt += 2
			m = map[int32]int{}
		}else{
			m[v] = 1
		}
	}
	fmt.Fprintln(out,len(str) - cnt)
}

func abs(a,b int)int{
	if a > b{
		return a - b
	}
	return b - a
}
func sum(a,b int64)int64{
	return (b + a) * (b - a + 1) / 2
}

func max(a,b int)int{
	if a > b{
		return a
	}
	return b
}
func min(a,b int)int{
	if a > b{
		return b
	}
	return a
}
func gcd(a,b int)int{
	if a % b == 0{
		return b
	}
	return gcd(b,a%b)
}

func main() {
	stdin := os.Stdin
	stdout := os.Stdout
	in := bufio.NewReader(stdin)
	out := bufio.NewWriter(stdout)
	n := 1
	fmt.Fscan(in, &n)
	for i := 0; i < n; i++ {
		solve(in, out)
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF1660C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T int
	var s string
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &s)
		ans := len(s)
		v := 0
		for _, b := range s {
			b := 1 << (b & 31)
			if v&b > 0 {
				ans -= 2
				v = 0
			} else {
				v |= b
			}
		}
		Fprintln(out, ans)
	}
}

func main() { CF1660C(os.Stdin, os.Stdout) }

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

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

func main() {
  defer writer.Flush()
  var t int
  for scanf("%d\n", &t) ; t > 0 ; t-- {
    var s string
    scanf("%s\n", &s)
    a := []byte(s)
    lastoff := make([]int, 256)
    for i := 0 ; i < 256 ; i++ {
      lastoff[i] = -1
    }
    sameoff := make([]int, len(a))
    x := -1
    for i := len(a) - 1 ; i >= 0 ; i-- {
      if lastoff[a[i]] == -1 {
        sameoff[i] = min(-1, x)
      } else {
        sameoff[i] = min(lastoff[a[i]] - i, x)
      }
      x = sameoff[i]
      if x != -1 {
        x++
      }
      lastoff[a[i]] = i
    }

    ans := 0
    for len(sameoff) > 0 {
      if sameoff[0] == -1 {
        ans++
        sameoff = sameoff[1:]
      } else {
        rem := sameoff[0] + 1
        ans += rem - 2
        sameoff = sameoff[rem:]
      }
    }
    printf("%d\n", ans)
  }
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	defer out.Flush()
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	for {
		if !scanner.Scan() {
			break
		}
		s := "#" + scanner.Text()
		n := len(s)
		d := make([]int, n)
		m := make(map[uint8][]int)
		for i := 1; i < n; i++ {
			j := m[s[i]]
			d[i] = d[i-1] + 1
			if i > 1 {
				if d[i-2]+2 < d[i] {
					d[i] = d[i-2] + 2
				}
			}
			x := len(j)
			if x > 0 {
				k := i - j[x-1] - 1 + d[j[x-1]-1]
				if x > 1 {
					q := i - j[x-2] - 1 + d[j[x-2]-1]
					if q < k {
						k = q
					}
				}
				if k < d[i] {
					d[i] = k
				}
			}
			if _, ok := m[s[i]]; ok {
				m[s[i]] = append(m[s[i]], i)
			} else {
				m[s[i]] = []int{i}
			}

		}
		fmt.Fprintln(out, d[n-1])
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

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

func main() {
	defer out.Flush()
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	for {
		if !scanner.Scan() {
			break
		}
		s := "#" + scanner.Text()
		n := len(s)
		d := make([]int, n)
		m := make(map[uint8]int)
		for i := 1; i < n; i++ {
			d[i] = d[i-1] + 1
			if i > 1 {
				d[i] = min(d[i], d[i-2]+2)
			}
			j := m[s[i]]
			if j > 0 {
				d[i] = min(d[i], i-j-1+d[j-1])
			}
			m[s[i]] = i
		}
		fmt.Fprintln(out, d[n-1])
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

const inf = 1e8

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

func main() {
	defer out.Flush()
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	for {
		if !scanner.Scan() {
			break
		}
		s := "#" + scanner.Text()
		n := len(s)
		d := make([][]int, n)
		for i := 0; i < n; i++ {
			d[i] = make([]int, 2)
		}
		m := make(map[uint8]int)
		for i := 1; i < n; i++ {
			d[i][0] = min(i, 1+min(d[i-1][0], d[i-1][1]))
			j := m[s[i]]
			if j > 0 {
				d[i][1] = i - j - 1 + min(d[j-1][0], d[j-1][1])
			} else {
				d[i][1] = i
			}
			m[s[i]] = i
		}
		fmt.Fprintln(out, min(d[n-1][0], d[n-1][1]))
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

const inf = 1e8

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

func main() {
	defer out.Flush()
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	for {
		if !scanner.Scan() {
			break
		}
		s := "#" + scanner.Text()
		n := len(s)
		d := make([][]int, n)
		for i := 0; i < n; i++ {
			d[i] = make([]int, 2)
		}
		m := make(map[uint8]int)
		for i := 1; i < n; i++ {
			d[i][0] = 1 + min(d[i-1][0], d[i-1][1])
			j := m[s[i]]
			if j > 0 {
				d[i][1] = i - j - 1 + min(d[j-1][0], d[j-1][1])
			} else {
				d[i][1] = i
			}
			m[s[i]] = i
		}
		fmt.Fprintln(out, min(d[n-1][0], d[n-1][1]))
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

const inf = 1e8

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

func main() {
	defer out.Flush()
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	for {
		if !scanner.Scan() {
			break
		}
		s := "#" + scanner.Text()
		n := len(s)
		d := make([][]int, n)
		for i := 0; i < n; i++ {
			d[i] = make([]int, 2)
		}
		m := make(map[uint8]int)
		for i := 1; i < n; i++ {
			d[i][0] = 1 + min(d[i-1][0], d[i-1][1])
			j := m[s[i]]
			if j > 0 {
				d[i][1] = i - j - 1 + min(d[j-1][0], d[j-1][1])
			} else {
				d[i][1] = inf
			}
			m[s[i]] = i
		}
		fmt.Fprintln(out, min(d[n-1][0], d[n-1][1]))
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	defer out.Flush()
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	for {
		if !scanner.Scan() {
			break
		}
		s := "#" + scanner.Text()
		n := len(s)
		d := make([]int, n)
		m := make(map[uint8][]int)
		for i := 1; i < n; i++ {
			d[i] = d[i-1] + 1
			x := m[s[i]]
			if len(x) > 0 {
				for _, j := range x {
					k := i - j - 1 + d[j-1]
					if k < d[i] {
						d[i] = k
					}
				}
			}
			if _, ok := m[s[i]]; ok {
				m[s[i]] = append(m[s[i]], i)
			} else {
				m[s[i]] = []int{i}
			}

		}
		res := d[1] + n - 2
		for i := 2; i < n; i++ {
			k := d[i] + n - i - 1
			if k < res {
				res = k
			}
		}
		fmt.Fprintln(out, res)
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	defer out.Flush()
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	for {
		if !scanner.Scan() {
			break
		}
		s := "#" + scanner.Text()
		n := len(s)
		d := make([]int, n)
		m := make(map[uint8][]int)
		for i := 1; i < n; i++ {
			d[i] = d[i-1] + 1
			x := m[s[i]]
			if len(x) > 0 {
				for _, j := range x {
					k := i - j - 1 + d[j-1]
					if k < d[i] {
						d[i] = k
					}
				}
			}
			if _, ok := m[s[i]]; ok {
				m[s[i]] = append(m[s[i]], i)
			} else {
				m[s[i]] = []int{i}
			}

		}
		fmt.Fprintln(out, d[n-1])
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	defer out.Flush()
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	for {
		if !scanner.Scan() {
			break
		}
		s := "#" + scanner.Text()
		n := len(s)
		d := make([]int, n)
		m := make(map[uint8][]int)
		for i := 1; i < n; i++ {
			j := m[s[i]]
			d[i] = d[i-1] + 1
			x := len(j)
			if x > 0 {
				k := i - j[x-1] - 1 + d[j[x-1]-1]
				if x > 1 {
					q := i - j[x-2] - 1 + d[j[x-2]-1]
					if q < k {
						k = q
					}
				}
				if k < d[i] {
					d[i] = k
				}
			}
			if _, ok := m[s[i]]; ok {
				m[s[i]] = append(m[s[i]], i)
			} else {
				m[s[i]] = []int{i}
			}

		}
		fmt.Fprintln(out, d[n-1])
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	defer out.Flush()
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	for {
		if !scanner.Scan() {
			break
		}
		s := "#" + scanner.Text()
		n := len(s)
		d := make([]int, n)
		m := make(map[uint8]int)
		for i := 1; i < n; i++ {
			j := m[s[i]]
			d[i] = d[i-1] + 1
			if j > 0 {
				k := i - j - 1 + d[j-1]
				if k < d[i] {
					d[i] = k
				}
			}
			m[s[i]] = i
		}
		fmt.Fprintln(out, d[n-1])
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	defer out.Flush()
	var t int
	fmt.Fscanf(in, "%d\n", &t)
	for t := t; t > 0; t-- {
		scanner := bufio.NewScanner(os.Stdin)
		scanner.Scan()
		s := "#" + scanner.Text()
		n := len(s)
		d := make([]int, n)
		m := make(map[uint8]int)
		for i := 1; i < n; i++ {
			j := m[s[i]]
			d[i] = d[i-1] + 1
			if j > 0 {
				k := i - j - 1 + d[j-1]
				if k < d[i] {
					d[i] = k
				}
			}
			m[s[i]] = i
		}
		fmt.Fprintln(out, d[n-1])
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func main() {
	Cf1660(os.Stdin, os.Stdout)
}

func Cf1660(_r io.Reader, _w io.Writer) {
	in, out := bufio.NewReader(_r), bufio.NewWriter(_w)
	defer out.Flush()

	cases := 0
	Fscan(in, &cases)

	var str string
	var n int

	for ; cases > 0; cases-- {
		Fscan(in, &str)
		n = len(str)
		str = "!" + str
		dp := make([]int, n+1) //dp[i]表示 第i个元素需要满足even string最少需要remove的个数
		dp[0] = 0              //初始化dp，表示移除0个元素最少需要0次
		vis := make(map[byte]int)
		cnt := make(map[byte]int)
		for i := 1; i <= n; i++ {
			if pos, ok := vis[str[i]]; !ok || cnt[str[i]]%2 == 0 {
				dp[i] = dp[i-1] + 1
			} else {
				dp[i] = min(dp[i-1]+1, dp[pos-1]+(i-pos-1))
			}
			vis[str[i]] = i
			cnt[str[i]]++
		}
		Fprintf(out, "%d\n", dp[n])
	}
}

func min(i, j int) int {
	if i < j {
		return i
	}
	return j
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func main() {
	Cf1660(os.Stdin, os.Stdout)
}

func Cf1660(_r io.Reader, _w io.Writer) {
	in, out := bufio.NewReader(_r), bufio.NewWriter(_w)
	defer out.Flush()

	cases := 0
	Fscan(in, &cases)

	var str string
	var n int

	for ; cases > 0; cases-- {
		Fscan(in, &str)
		n = len(str)
		str = "!" + str
		dp := make([]int, n+1) //dp[i]表示 第i个元素需要满足even string最少需要remove的个数
		dp[0] = 0              //初始化dp，表示移除0个元素最少需要0次
		vis := make(map[byte]int)
		cnt := make(map[byte]int)
		for i := 1; i <= n; i++ {
			if pos, ok := vis[str[i]]; !ok || cnt[str[i]]%2 == 0 {
				dp[i] = dp[i-1] + 1
			} else {
				dp[i] = min(dp[i-1]+1, dp[pos-1] + (i - pos - 1))
			}
			vis[str[i]] = i
			cnt[str[i]]++
		}
		Println(dp)
		Fprintf(out, "%d\n", dp[n])
	}
}

func min(i, j int) int {
	if i < j {return i}
	return j
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func main() {
	Cf1660(os.Stdin, os.Stdout)
}

func Cf1660(_r io.Reader, _w io.Writer) {
	in, out := bufio.NewReader(_r), bufio.NewWriter(_w)
	defer out.Flush()

	cases := 0
	Fscan(in, &cases)

	var str string
	var n int

	for ; cases > 0; cases-- {
		Fscan(in, &str)
		n = len(str)
		str = "!" + str
		dp := make([]int, n+1) //dp[i]表示 第i个元素需要满足even string最少需要remove的个数
		dp[0] = 0              //初始化dp，表示移除0个元素最少需要0次
		vis := make(map[byte]int)
		for i := 1; i <= n; i++ {
			if pos, ok := vis[str[i]]; !ok {
				dp[i] = dp[i-1] + 1
			} else {
				dp[i] = dp[pos-1] + (i - pos - 1)
			}
			vis[str[i]] = i
		}
		Fprintf(out, "%d\n", dp[n])
	}
}

package main

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

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

var in = bufio.NewReader(os.Stdin)

func solve(){
	var s string
	fmt.Fscan(in,&s)
	n:=len(s)
	s=" " + s
	dp:=make([]int,n+1)
	pos:=make([]int,26)

	// fmt.Print(s,n," ")
	for i:=1;i<=n;i++{
		dp[i]=dp[i-1] + 1
		l:=pos[s[i]-'a']
		if l>0 {
			dp[i]=min(dp[i],dp[l-1] + i - l - 1)
		}
		pos[s[i]-'a']=l;
	}

	fmt.Println(dp[n])
}
func main() {
	var tc int
    fmt.Scan(&tc)
	// fmt.Print(tc)
	for i:=0;i<tc;i++{
		solve()
	}
}

package main

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

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

var in = bufio.NewReader(os.Stdin)

func solve(){
	var s string
	fmt.Fscan(in,s)
	n:=len(s)
	s=" " + s
	dp:=make([]int,n+1)
	pos:=make([]int,26)

	for i:=1;i<=n;i++{
		dp[i]=dp[i-1]
		l:=pos[s[i]-'a']
		if l>0 {
			dp[i]=min(dp[i],dp[l-1] + i - l - 1)
		}
		pos[s[i]-'a']=l;
	}

	fmt.Println(dp[n])
}
func main() {
	var tc int
    fmt.Scan(&tc)
	// fmt.Print(tc)
	for i:=0;i<tc;i++{
		solve()
	}
}