var result = 0;
var total = readline();
for(var i = 0; i< total; i++){
  var item = readline().split(' ');
  if(parseInt(item[1]) - parseInt(item[0]) >= 2) result ++;
}
print(result);

var n = Number(readline());
var k =0;
for (var i = 0; i < n; ++i){
    var str = readline();
    var a = Number(str.split(" ")[0]);
    var b = Number(str.split(" ")[1]);
    if ((b-a) >=2 ){
        ++k;
        }
}
print(k);

var n = +readline(), input, p, q, counter = 0;

for(i = 0; i < n; i++){
	input = readline().split(" ");
	p = +input[0];
	q = +input[1];

	if( (q-p) >= 2 ){
		counter++;
	}
}
write(counter);

var n = readline()

var sum = 0

for(var i = 0; i < n ;i++) {
    var line = readline().split(' ')
    var a = parseInt(line[0])
    var b = parseInt(line[1])

    if(b - a - 2 >= 0) {
        sum++
    }
}

print(sum)

function main(){
    var n = readline();
    var res = 0;
    for(var i = 0; i < n; ++i){
        var c = readline().split(' ');;
        if(+c[1] - +c[0] >= 2) ++res;
    }
    print(res);
}

main();

var r=+readline();
var j=0;
for(var i=0;i<r;i++){
    var p=readline().split(' ');
    var q=+p[1];
    var d=+p[0];
    if((q-d) >= 2){
        j++;
    }
}
print(j);

var r = +readline(), p, q, d, count = 0;
for(i=0; i < r; i++){
    p = readline().split(" ");
    q = +p[1];
    d = +p[0];
    if((q-d) >= 2){
        count++;
    }
}
write(count);

var n = readline() - 0;

var t = 0;
for (var i = 0; i < n; i++) {
    var IN = readNums();
    if (IN[1] - IN[0] >= 2) {
        t++;
    }
}
print(t);

function readNums() {
    return readline().split(' ').map(v => v - 0);
}

m=readline()
sum=0
for(i=0;i<m;i++)
{
   r=readline().split(' ')
   if(parseInt(r[0])<=parseInt(r[1])-2 )
       sum=sum+1

}
print(sum)

print(answer());
function answer(){
    var numRooms = readline();
    var room;
    var output = 0;
    for(var i = 0; i < numRooms; i++){
        room = readline().split(' ');
        if(room[1]-room[0] >= 2){
            output++;
        }
    }
    return output;
}

var n = readline();
var count = 0;

for (var i = 0; i < n; i++) {
    var str = readline().split(' ');
    if ((str[1] - str[0]) >= 2) count++;
}

print(count);

var n = parseInt(readline()),
	counter = 0

while (n > 0) {
	var ns = readline().split(' ').map(function(i) {
		return parseInt(i)
	})
	if (ns[1] - ns[0] > 1)
		counter ++
	n --
}

print(counter)

var numberOfRoom = +readline();
var answer = 0;
for(var i = 1; i <= numberOfRoom; i ++) {
    var line = readline().split(' ');
    if(+line[0]+2 <= +line[1]) {
        answer++;
    }
}

print(answer);

var no_rooms = parseInt(readline());
var available = 0;
for(var i=0; i<no_rooms; i++){
    var acc = readline().split(" ").map(x=>parseInt(x));
    var already  = acc[0];
    var capacity = acc[1];
    if(capacity-already >=2){
        available++;
    }
}
print(available);

;(function () {
	print(function (n) {
		var t = 0;
		while (n--) t += Number(readline().split(' ').map(Number).reduce(function (a, b) { return Math.abs(a - b); }) > 1);
		return t;
	}(+readline()));
}.call(this));

var lines = +readline();
var counter = 0;

for(var i = 0; i < lines; i ++){
	var pq = readline().split(' ').map(x => +x);
	var p = pq[0];
	var q = pq[1];
	if(q - p >= 2){
		// Possible to move in
		counter ++;
	}
}

print(counter);

var strArray = [];

var numberIterations = readline();
var countOfLivibleFloors = 0;

for (var i = 0; i < numberIterations; i++) {
    strArray.push(readline());
}

for (var i = 0; i < strArray.length; i++) {
  strFloor = strArray[i].split(" ");
  if ( (parseInt(strFloor[1]) - parseInt(strFloor[0])) >= 2) {
    countOfLivibleFloors++;
  }
}

print(countOfLivibleFloors)

var limit = readline();
var count = 0
while(limit > 0){
    var line = readline().split(" ")
    var numPeopleInRoom = parseInt(line[0]);
    var limitRoom = parseInt(line[1])
    if(numPeopleInRoom + 2 <= limitRoom) count++
    limit--
}

print(count)

var n = parseInt(readline());

var ans = 0;
for(var i=0;i<n;i++){
    var p,q;
    var temp = readline();
    p = temp.split(" ")[0];
    q = temp.split(" ")[1];
    if(q-p>=2){
        ans++;
    }
}

print(ans);

var n = parseInt(readline());
var count = 0;
for(var i = 0; i<n; i++) {
    var s = readline().split(" ");
    if (s[1] - s[0] >= 2) {
        count++;
    }
}
print(count);

var a = readline();

var rooms = [];
var freeRooms = 0;

function proc(){
  var res = true;
  while(res){
    res = readline();
    if (!res) break;
    rooms.push(res);
  }
}

proc();

for (var i = 0; i < rooms.length ; i++) {
  var s = rooms[i].split(' ');
  if((Number(s[1]) - Number(s[0])) >= 2 ) {
      freeRooms++;
  }
}

print(freeRooms);

(function () {
    var n = parseInt(readline()),
        i = 0,
        sum = 0,
        line;
    for (; i < n; i++) {
        line = readline().split(" ");
        if ((line[1] - line[0]) > 1) {
            sum++;
        }
    }
    print(sum);
})();

const main = () => {
  const n = readline();
  const arr = [];
  var numRooms = 0;

  for (i of Array(Number(n))
    .fill()
    .map((a, b) => parseInt(b))) {
    arr.push(
      readline()
        .split(" ")
        .map((x) => parseInt(x))
    );
  }

  for (i of arr) {
    if (i[0] + 2 <= i[1]){
      numRooms++;
    }
  }
  print(numRooms);
};
main();

var line = readline()
  var result = 0

  while (line--) {
    var currentRoom = readline().split(' ')
    var currentOcupacy = parseInt(currentRoom[0], 10)
    var maxOcupacy = parseInt(currentRoom[1], 10)
    if (currentOcupacy + 2 <= maxOcupacy) result++
  }

  print(result)

var a = readline();

var rooms = [];
var freeRooms = 0;

function read () {
    return readline() ;
}

function proc(){
  var res = true;
  while(res){
    res = read();
    if (!res) break;
    rooms.push(res);
  }
}

proc();

for (var i = 0; i < rooms.length ; i++) {
  var s = rooms[i].split(' ');
  if((Number(s[1]) - Number(s[0])) >= 2 ) {
      freeRooms++;
  }
}

print(freeRooms);

function ProblemSolver() {

    this.solveCase = function() {
        var res , i , j , a ;
        res = 0;
        for( i = 0 ; i < this.n ; i++ ) {
            a = Math.abs( this.arr[ i ] - this.brr[ i ] ) ;
            if( a >= 2 ) {
                res++ ;
            }
        }
        print( res );
    };

    this.getInput = function( irObj ) {
        var hasMoreInput , i;
        hasMoreInput = true;
        try {
            this.n = irObj.nextInt();
            for( i = 0 ; i < this.n ; i++ ) {
                this.arr[ i ] = irObj.nextInt();
                this.brr[ i ] = irObj.nextInt();
            }
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

    this.clearArraysPerCase = function() {
        var i;
        this.arr = new Array();
        this.brr = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
    };

    this.clearPerCase = function() {
        this.cn = 0;
        this.cc++;
        //this.clearArraysPerCase() ;
    };

    this.HAS_TEST_CASES = false;
    this.INPUT_FILE_NAME = "test.in";
    this.OUTPUT_FILE_NAME = "out.txt";
    this.DO_OUTPUT_TO_FILE = false;

    this.declareAndFillArrays = function() {
        var i , j;
        this.srr = new Array();
        this.vis = new Array();
        this.arr = new Array();
        this.brr = new Array();
        this.memo = new Array();
        this.done = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( "" );
            this.vis.push( 0 );
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
        for( i = 0 ; i < this.lim2 ; i++ ) {
            this.memo.push( new Array() );
            this.done.push( new Array() );
            for( j = 0 ; j < this.lim2 ; j++ ) {
                this.memo[ i ].push( -1 );
                this.done[ i ].push( 0 );
            }
        }
    };

    this.init = function() {
        this.lim1 = 100010;
        this.lim2 = 110;
        this.cc = 1;
        this.ind = 1;
        this.n = 0;
        this.cn = 0;
        this.declareAndFillArrays();
    };

    this.memsetArray1D = function( arrParam , val ) {
        var i;
        if( arrParam == null ) {
            throw new Error( "No array supplied in the parameter!" );
        }
        if( val == null ) {
            throw new Error( "No value for memset has been supplied in the parameter!" );
        }
        arrParam = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            arrParam.push( val );
        }
        return arrParam;
    };

    this.getStringLength = function( stringData ) {
        var len , lengthType;
        len = stringData.length;
        lengthType = typeof len;
        if( lengthType == "function" ) {
            len = stringData.length();
        }
        else {
            len = stringData.length;
        }
        return len;
    };

    this.init();
}

function InputReader() {
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;

    this.readAllLines = function() {
        var singleLine;
        while( true ) {
            try {
                singleLine = readline();
                if( singleLine == null ) {
                    break;
                }
            }
            catch( ex ) {
                break;
            }
            this.allLines.push( singleLine );
        }
    };

    this.readAllLinesFromRhinoStdin = function() {
        importPackage( java.io );
        importPackage( java.lang );
        var singleLine , reader;
        reader = new BufferedReader( new InputStreamReader( System[ "in" ] ) );
        this.allLines = [];
        while( true ) {
            singleLine = reader.readLine();
            if( singleLine != null ) {
                this.allLines.push( singleLine );
            }
            else {
                break;
            }
        }
    };

    this.readAllLinesFromNodeStdin = function() {
        var fsObj , size , rawData;
        process.stdin.setEncoding( 'ascii' );
        fsObj = require( 'fs' );
        size = fsObj.fstatSync( process.stdin.fd ).size;
        rawData = fsObj.readSync( process.stdin.fd , size )[ 0 ];
        this.parseRawData( rawData );
    };

    this.parseRawData = function( data ) {
        var len , i , currentString;
        len = data.length;
        currentString = "";
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString );
                currentString = "";
            }
            else {
                currentString += data[ i ];
            }
        }
        if( currentString != "" ) {
            this.allLines.push( currentString );
        }
    };

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData;
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        inputFilePath = currentDirectory + "\\" + inputFileName;
        rawData = fsObj.readFileSync( inputFilePath , "utf8" );
        this.parseRawData( rawData );
    };

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx , lengthType;
        len = this.allLines[ this.currrentLineNumber ].length;
        lengthType = typeof len;
        if( lengthType == "function" ) {
            len = this.allLines[ this.currrentLineNumber ].length();
        }
        if( flag == 0 ) {
            res = "";
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += String.fromCharCode( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) );
            }
            this.currrentLineNumber++;
            this.currrentCharacterIndex = 0;
            return res;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( "No more tokens available!" );
            }
            startIdx = -1;
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != '\t'.charCodeAt( 0 ) ) {
                    startIdx = i;
                    break;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
                continue;
            }
            res = "";
            endIdx = -1;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) || this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == '\t'.charCodeAt( 0 ) ) {
                    endIdx = i;
                    break;
                }
                res += String.fromCharCode( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) );
            }
            if( endIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            else {
                this.currrentCharacterIndex = endIdx;
            }
            return res;
        }
    };

    this.nextInt = function() {
        return parseInt( this.next( 1 ) );
    };

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) );
    };

    this.nextString = function() {
        return this.next( 1 );
    };

    this.nextLine = function() {
        this.next( 0 );
    };
}

function FileOutputHandler() {
    this.resultantStringArray = new Array();

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString );
    };

    this.clearPercase = function() {
        this.resultantStringArray = new Array();
    };

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath;
        res = "";
        sz = this.resultantStringArray.length;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += "\n";
            }
            res += this.resultantStringArray[ i ];
        }
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        outputFilePath = currentDirectory + "\\" + outputFileName;
        if( currentDirectory.charAt( 1 ) != ":" ) {
            //not local machine/windows
            outputFilePath = outputFileName;
        }
        fsObj.writeFileSync( outputFilePath , res );
        this.clearPercase();
    };
}

function CodeExecutioner() {
    this.irObj = new InputReader();
    this.psObj = new ProblemSolver();
    this.fohObj = new FileOutputHandler();

    this.runCode = function() {
        var testCases , i , hasMoreTestCases , isLocalMachine , localContext;
        isLocalMachine = false;
        try {
            if( __dirname != null && __dirname.charAt( 1 ) == ':' ) {
                //only on windows
                isLocalMachine = true;
            }
        }
        catch( ex ) {
            isLocalMachine = false;
        }
        if( isLocalMachine == true ) {
            //local machine runs on node and relies on file i/o
            print = console.log;
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
        }
        else {
            //server machine
            try {
                var rlObj = readline;
                //server runs on javasctipt v8 distribution and has readline method on global context
                this.irObj.readAllLines();
            }
            catch( ex ) {
                try {
                    var pObj = process;
                    //server runs on node
                    print = console.log;
                    this.irObj.readAllLinesFromNodeStdin();
                }
                catch( ex ) {
                    try {
                        var ipObj = importPackage;
                        //server runs on rhino
                        this.irObj.readAllLinesFromRhinoStdin();
                    }
                    catch( ex ) {
                        throw new Error( "Unknown javasctipt distribution!" );
                    }
                }
            }
        }
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            //only works for local machine(tested)
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.runCode();
}

new CodeExecutioner();

var n = readline();
var s = [];
for (var i = 0; i < n; i++)
    s.push(readline().split(' '));
var count = 0;
for (var i = 0; i < n; i++)
    if ((s[i][1] - s[i][0]) >= 2)
        count++;
print(count);

var n = parseInt(readline());
var s = [];
for (var i = 0; i < n; i++)
    s.push(readline().split(' '));
var count = 0;
for (var i = 0; i < n; i++)
    if ((parseInt(s[i][1]) - parseInt(s[i][0])) >= 2)
        count++;
print(count);

var n = parseInt(readline());
var count = 0;
for (var i = 0; i < n; i ++){
    var string = readline().split(" ");
    var numberOfPeople = parseInt(string[0]);
    var maxNumberOfPeople = parseInt(string[1]);
    if ((maxNumberOfPeople - numberOfPeople) >= 2){
        count++;
    }
}
print(count);

var n = parseInt(readline());
var freeroom = 0;

for(var i = 0; i < n; i++)
{
	var pq = readline().split(' ');
	if((parseInt(pq[0]) + 2) <= parseInt(pq[1]))
		freeroom++;
}

print(freeroom);

readline();
var rooms = [];
var freeRooms = 0;
var res = true;
while(res){
  res = readline();
  if (!res) break;
  rooms.push(res);
}
for (var i = 0; i < rooms.length ; i++) {
  var s = rooms[i].split(' ');
  if((s[1] - s[0]) >= 2 ) {
      freeRooms++;
  }
}
print(freeRooms);

/* TEST CASE
input
3
1 1
2 2
3 3
output
0

input
3
1 10
0 10
10 10
output
2

 */
function main() {
	var n = parseInt(readline());
	var answer = 0;

	for (var i = 0; i < n; i++) {
		var s = readline().split(' ');
		if (parseInt(s[1]) - parseInt(s[0]) >= 2) {
			answer++;
		}
	}

	print(answer);
}

main();

var n = parseInt(readline());
var freeroom = 0;

for(var i = 0; i < n; i++)
{
	var pq = readline().split(' ');
	if((parseInt(pq[1]) - parseInt(pq[0])) >= 2)
		freeroom++;
}

print(freeroom);

'use strict';
let n = parseInt(readline()),
    answer = 0;

for (let i = 0; i < n; i++) {
    const array = readline().split(' ').map(function(value) {
        return parseInt(value);
    });

     if (array[1] - array[0] >= 2) {
        answer++;
     }
}

write(answer);

const n = parseInt(readline())
var count = 0
for (var i = 0; i < n; i++){
  var line = readline()
  var lineArr = line.split(" ")
  var p = parseInt(lineArr[0])
  var q = parseInt(lineArr[1])
  if (q - p >= 2){
    count++;
  }
}
print(count)

var n =readline();
var x = 0;
var str1 = "";
var room = [];
for (i=1;i<=n;i++) room.push(readline());
for(i=0;i<room.length;i++){
	str1 = room[i];
	var str = str1.split(" ");
	if ((str[1]-str[0])>=2) x++;
}
print (x);

var n = parseInt(readline()),
			count = 0;

		for(var i = 0; i < n; i++)	{
			var p = readline().split(/\s/gi),
				q = p[1], p = p[0];

			if(p <= q - 2)	count++;
		}

		print(count);

var n = parseInt(readline());

var room = 0;
for (var i = 0; i < n; i++) {
    var s = readline().split(' ');

    if (s[1] - s[0] >= 2) {
        room++;
    }
}

print(room);

var str = Number(readline()),
    res = 0;

for (var i = 0; i < str; i++) {
    var data = readline().split(' '),
        now = Number(data[0]),
        all = Number(data[1]);

        if (now + 2 <= all) res++;
}

print(res);

var entrada = readline();
var hab = 0;

for(var i = 0; i < entrada; i++){

	var num = readline();
	num = num.split(" ");
	var resta = num[1] - num[0];

	if( resta>=2){
		hab++;
	}
}

print(hab);

function UraAndRooms(arr)
{
    var result = 0;
    function minus(a)
    {
        return +a[1] - +a[0];
    }
    for (var i = 0; i <= arr.length - 1; i++)
    {
        var count = minus(arr[i].split(' '));
        if (count >= 2 ) result++;
    }
    return result;

}
{
	var arr = [];
    var num = readline();
	for (var i = 1; i <= +num; i++)
	{
		var input = readline();
		arr.push(input);
	}
	print(UraAndRooms(arr));

}

var r = readline();
var room = 0;
for(var i = 0; i < r; i++){
	var n = readline().split(" ");
	if(n[1] - n[0] >=2)
		room++;
}
print(room);

var num = readline();
var count = 0;
while(num--){

    var room = readline().split(' ');
    if(room[1] - room[0] >= 2){
        count++;
    }
}

print(count);

var n = parseInt(readline(), 10),
    inp = '',
    room = 0;

for(var i=1; i<=n; i++) {
    inp = readline().split(' ');

    if(inp[1]-inp[0] >= 2) room++;
}

print(room);

var n = readline()
var bol = 0
for (var i = 0; i < n; i++) {
    var rez = 0
    var line = readline()
    line = line.split(" ")
    rez = line[1] - line[0]
    if(rez >= 2){
        bol++
    }
}
print(bol)

var n = parseInt(readline());
var ar = [];
var res = 0;

for (var i = 0; i < n; i++) {
	ar[i] = readline().split(' ').map(function(i) {
		return parseInt(i);
	});

	if (ar[i][0] + 2 <= ar[i][1]) {
		res++;
	}
}

print(res);

var linenum = parseInt(readline());
var i, nums, count = 0;
for(i=0;i<linenum;i++){
    nums = readline().split(' ').map(function(numStr){
        return parseInt(numStr);
    });
    if(nums[1] - nums[0] >= 2){
        count ++;
    }
}

print(count);

(function () {
    var count = parseInt(readline());

    var result = 0;
    for (var i = 0; i < count; i++){
        var nums = readline().trim().split(' ').map(Number);
        if (nums[0] + 2 <= nums[1]){
            result++;
        }
    }

    print(result);

    return 0;
})();

var a, b = 0;
readline();

while (a = readline()) {
  a = a.split(' ');
  if (a[1] - a[0] > 1) b++;
}

print(b);

var n = readline();
var res =0;

	for (var i=0; i<n; i++){
		var str = readline().split(" ");
		if (str[1]-str[0]>=2)
		{
			res++;
		}
	}
	print(res);

var n = parseInt(readline())
var c = 0;
for(var i = 0; i < n; ++i) {
	var line = readline().split(" ");
	p = parseInt(line[0]);
	q = parseInt(line[1]);

	if(q - p >= 2) {
		++ c;
	}
}
print(c);

var n = Number(readline());

var count = 0;
while (n > 0) {
    var s = readline().split(' ').map(function(each) {return Number(each);});
    if (s[1] - s[0] >= 2)
        ++count;
    --n;
}

print(count);

function main(){

    var n = readline();
    var count = 0;

    for(i=0;i<n;i++){
	var line = readline().split(' ');
	var p = line[0];
	var q = line[1];

	if(q-p>=2){
	    count+=1;
	}
    }

    print(count);
}

main();

no = readline();
var vector;
var t = 0;
for (var i = 0; i < no; i++) {
         vector = readline().split(' ');
         if( parseInt(vector[1]) - parseInt(vector[0]) >=2 )
             t++;
}
write(t);

var n = readline();
var quan = 0;

for (var i=0; i<n; i++) {
    var s = readline().split(' ');
    (Number(s[0])+2 <= s[1])?quan++:0;
}

print(quan);

// 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.

var n = readline()
var c = 0

for (i = 0; i < n; i++) {
    var x = readline().split(' ')
    if (+x[1] - (+x[0] + 2) >= 0) {
        c++
    }
}

print(c)

var n = readline();
var rooms = [];
for (var i = 0;i < n; ++i){
  var temp = readline().split(" ");
  rooms.push(temp);
}
var result = rooms.filter((room) => {
  if(room[1] - room[0] >= 2) return true;
  return false;
}).length;

print(result);

var n = parseInt(readline());

var room = 0;

for (var i = 0; i < n; i++) {

    var numbers = readline().split(" ").map(function(x) { return parseInt(x); });

    room = numbers[1] - numbers[0] >= 2 ? room + 1 : room;
}

print(room);

var rooms = readline()
var count = 0
for(var i=1; i <= rooms; i++){
var line = readline(i).split(" ")
if ((line[1] - line[0]) >= 2){
    count ++
}
}
print(count)

var count = readline();var calc = 0;

for (var i = 0; i < count; i++)
{
var r = readline().split(' ');r =r[1] - r[0];
if(r>=2){calc+=1;}
}

print(calc);

(function () {
    var n = parseInt(readline()),
        i = 0,
        sum = 0,
        line;
    for (; i < n; i++) {
        line = readline().split(" ");
        if ((line[1] - line[0]) > 1) {
            sum++;
        }
    }
    print(sum);
})();

n = readline();
var count = 0;
while(n--){
	k = readline().split(" ")
	if(parseInt(k[0]) + 1 < parseInt(k[1]))
	{count++}
}
print(count)

var input = readline();
var cont = 0;
for(var i = 0; i < input; i++){
	var ocupantes = readline().split(" ");
	if(ocupantes[1] - ocupantes[0] >=2)
		cont++;
}
print(cont);

var numberRooms = readline();
var numberFreeRooms = 0;
for (var n=0; n < numberRooms; n++) {
    var roomInfo = readline().split(' ');
    var numberOccupiedPlace = roomInfo[0];
    var numberSeatsRoom = roomInfo[1];
    if (numberSeatsRoom-numberOccupiedPlace >= 2) {
        numberFreeRooms++;
    }
}
print(numberFreeRooms);

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var output = 0;
  for(var i = 0; i < N; i++){
    var tmp = nextIntArray();
    if(tmp[1] - tmp[0] >= 2){
      output++;
    }
  }
  myout(output);
}

let inputString = '';
let currentLine = 0;

const runMain = () => {
  inputString = inputString.trim().split('\n').map(string => string.trim());
  main();
  process.exit();
}
const readLine = () => inputString[currentLine++];

process.stdin.on('data', inputStdin => inputString += inputStdin);
process.stdin.on('end', runMain);
process.on('SIGINT', runMain);

function main() {
  let n = Number(readLine());
  let sum = 0;
  while (n--) {
    const [p, q] = readLine().split(' ').map(_a => Number(_a));
    if (q - p > 1) {
      sum++;
    }
  }
  console.log(sum);
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

let first = true;
const rooms = [];
rl.on('line', line => {
    if (first) {
        first = false;
        return;
    }

    const input = line.split(' ');
    rooms.push(input);
});

rl.on('close', () => console.log(solution(rooms)));

function solution(rooms) {
    let numberOfAvailableRooms = 0;
    for (let i = 0; i < rooms.length; i++) {
        let room = rooms[i];
        let freeSpaceInRoom = room[1] - room[0];
        if (freeSpaceInRoom > 1) {
            numberOfAvailableRooms++;
        }
    }

    return numberOfAvailableRooms;
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let counter = 0;
let ans = 0;

rl.on('line', (d) => {
  if (counter === 0) {
    counter++;
    return;
  }

  let [p, q] = d.split(' ').map(Number);

  if (p + 2 <= q) {
    ans++;
  }
  counter++;
});

rl.on('close', () => {
  console.log(ans);
});

const readLine = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
});

const input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
  let answer = 0;
  input.forEach((line, i) => {
    if (i === 0) return;
    const nums = line.split(' ').map(x => parseInt(x));

    if (nums[1] - nums[0] >= 2) answer += 1;
  });

  console.log(answer);
});

'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

const readLine=()=> inputString[currentLine++];
/* ================================================
           Main Solution Starts Here
===================================================*/

const main=()=>{
	let t=+readLine()
	let rooms=0

	while(t--){
		let [a,b] = readLine().split(" ").map(n=>+n)
		if(b-a>=2)
			rooms++
	}

	console.log(rooms)
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function readAsInt(){
  return parseInt(readline());
}

function readAsIntList(){
  return readline().split(' ').filter(i => i).map(i => parseInt(i));
}

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  let n = readAsInt();
  let total = 0;
  for(let i = 1;i <= n; i++){
    let [p, q] = readAsIntList();
    total += (q - p) >= 2 ? 1 : 0;
  }
  console.log(total);
}

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let currentLine = 0;
let inputString = "";

process.stdin.on("data", (raw_data) => {
  inputString += raw_data;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

function readLine() {
  return inputString[currentLine++];
}

/******** Main function*************/

function main() {
  var n = +readLine();

  var arr = [];
  for (var i = 0; i < n; i++) {
    var s = readLine().split(" ").map(Number);
    arr.push(...s);
  }

  var item1 = 0;
  var item2 = 1;
  var count = 0;
  while (n > 0) {
    if (arr[item2] - arr[item1] >= 2) {
      count++;
    }
    item1 += 2;
    item2 += 2;
    n--;
  }
  console.log(count);
}

let fs = require("fs");

let txt = fs.readFileSync(0, "utf-8").split("\r\n").filter(data => {
    return data.length > 0;
});

for (let index = 0; index < txt.length; index ++) {
    if(!isNaN(txt[index]*1)){
        let tab=0;
        for (let i = index+1; i <=index+txt[index]*1; i++) {
            let r=txt[i].split(" ");
            if(r[1]-r[0]>=2){
                ++tab;
            }
        }
        console.log(tab);

    }

}

// Sample code to perform I/O:

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
    main(stdin_input);
});

function main(input) {
    let output = nameLookUp(input);
    process.stdout.write(output);       // Writing output to STDOUT
}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

// Write your code here
function nameLookUp(str) {
    let inputs = str.trim().split('\n');
    let rooms = +inputs[0];
    let roomsLeft = 0;
    for (let i = 1; i <= rooms; i++) {
        let [p, q] = inputs[i].trim().split(' ');
        if ((q - p) >= 2) {
            roomsLeft++;
        }
    }
    return roomsLeft.toString();
}

const readLine = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout,
});

const input = [];
readLine.on('line', line => input.push(line));
const rooms = () => {
    +input.shift();
    let count = 0;
    for (const x of input) {
        let n = x.split(' ').map(x => +x);
        for (let i = 1; i > 0; i--) {
            if (n[i] - n[i-1] >= 2) {
                count++;
            }
        }
    }
    console.log(count);
};
readLine.on('close', rooms);

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    let n = parseInt(readLine());
    let ans = 0;
    for (var i = 0; i < n; i++) {
        const arr = readLine()
            .split(' ')
            .map(value => parseInt(value));

        if (arr[1] - arr[0] >= 2) {
            ans++;
        }
    }
    console.log(ans);
}

var n  = readline();
var str = readline().split(" ");// 3;
//var b = +str[1];
var room = 0;
	for (var i=0; i<+n; i++){

			if(+str[1]>=+str[0]+2)
			room++;
	}
print(room);

var a = readline();

var rooms = [];
var freeRooms = 0;

// for (let i = 0; i < a ; i++) {
//  var value = readline();
//   var s = value.split(' ');
//   if((Number(s[1]) - Number(s[0])) >= 2 ) {
//       freeRooms++;
//   }

//}

print(freeRooms);

const a = readline();
const b = [];
for (var i=0;i<a;i++){
  b.push(readline());
}
print(0);

var a = readline();

var rooms = [];
var freeRooms = 0;

function read () {
    var stroka = readline();
    return stroka === undefined || false ;
}

function proc(){
    while(read()){

    }
}

// for (let i = 0; i < a ; i++) {
//  var value = readline();
//   var s = value.split(' ');
//   if((Number(s[1]) - Number(s[0])) >= 2 ) {
//       freeRooms++;
//   }

//}

print(freeRooms);

const n = parseInt(readline())
var count = 0
for (var i = 0; i < n; i++){
  const lineArr = readline().split(' ')
  const p = parseInt(lineArr[0])
  const q = parseInt(lineArr[1])
  if (q - p >= 2)
    count++;
}
print(count)

const n = readline()
var count = 0
for (var i = 0; i < n; i++){
  const lineArr = readline().split(' ')
  const p = lineArr[0];
  const q = lineArr[1];
  if (q - p >= 2){
    count++;
  }
}
print(count)

const n = parseInt(readline())
var count = 0
for (var i = 0; i < n; i++){
  var line = readline()
  print(line)
  var lineArr = line.split(" ")
  const p = parseInt(lineArr[0])
  const q = parseInt(lineArr[1])
  if (q - p >= 2){
    count++;
  }
}
print(count)

const n = parseInt(readline())
var count = 0
for (var i = 0; i < n; i++){
  var lineArr = readline().split(' ')
  const p = parseInt(lineArr[0])
  const q = parseInt(lineArr[1])
  if (q - p >= 2)
    count++;
}
print(count)

const n = parseInt(readline())
var count = 0
for (var i = 0; i < n; i++){
  var line = readline()
  var lineArr = line.split(" ")
  const p = parseInt(lineArr[0])
  const q = parseInt(lineArr[1])
  if (q - p >= 2){
    count++;
  }
}
print(count)

const n = parseInt(readline())
var count = 0
for (var i = 0; i < n; i++){
  var line = readline()
  var lineArr = line.split(" ")
  print(lineArr[0])
  print(lineArr[1])
  const p = parseInt(lineArr[0])
  const q = parseInt(lineArr[1])
  if (q - p >= 2){
    count++;
  }
}
print(count)

const n = parseInt(readline())
var count = 0
for (var i = 0; i < n; i++){
  var line;
  while (line === undefined) {
    line = readline()
  }
  const lineArr = line.split(' ')
  const p = parseInt(lineArr[0])
  const q = parseInt(lineArr[1])
  if (q - p >= 2)
    count++;
}
print(count)

var n = parseInt(readline()),
			count = 0;

		for(var i = 0; i < n; i++)	{
			var p = readline().split(/\s/gi),
				q = p[1], p = p[0];

			if(p < q - 2)	count++;
		}

		print(count);

var n = parseInt(readline()),
			count = 0;

		for(var i = 0; i < n; i++)	{
			var p = readline().split(/\s/gi),
				q = p[1], p = p[0];

			if(p < q)	count++;
		}

		print(count);

var rooms = readline()
var count = 0
for(var i=1; i < rooms; i++){
var line = readline(i).split(" ")
if ((line[1] - line[0]) >= 2){
    count ++
}
}

print(count)

var count = readline();var calc = 0;
for (var i = 0; i < count.length; i++)
{
r = readline(); r = (r[1] - r[0]);if(r>=2){calc+=1;}

}
print(calc);

var count = readline();var calc = 0;

for (var i = 0; i < count.length; i++)
{
var r = readline().split(' ');
r = parseInt(r[1]) -  parseInt(r[0]);
if(r>=2){calc+=1;}

}
print(calc);

var count = readline();var calc = 0;
for (var i = 0; i < count.length; i++)
{
r = readline().split(' ');
r = parseInt(r[1]) -  parseInt(r[0]);
if(r>=2){calc+=1;}

}
print(calc);

var count = readline();var calc = 0;
for (var i = 0; i < count.length; i++)
{
r = readline().split(' ');
r = parseInt(r[1] - r[0]);
if(r>=2){calc+=1;}

}
print(calc);

var count = readline();var calc = 0;
for (var i = 0; i < count.length; i++)
{
r = readline().split(' ');
r = (r[1] - r[0]);
if(r>=2){calc+=1;}

}
print(calc);

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let currentLine = 0;
let inputString = "";

process.stdin.on("data", (raw_data) => {
  inputString += raw_data;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

function readLine() {
  return inputString[currentLine++];
}

/******** Main function*************/

function main() {
  var n = +readLine();

  var arr = [];
  for (var i = 0; i < n; i++) {
    var s = readLine().split(" ").map(Number);
    arr.push(...s);
  }

  var item1 = 0;
  var item2 = 1;
  var count = 0;
  while (n > 0) {
    if (arr[item2] - arr[item1]) {
      count++;
    }
    item1 += 2;
    item2 += 2;
    n--;
  }
  console.log(count);
}

var r= +readline();
var counter=0;
for(var i=0; i<r; i++){
    var p= +readline().split(), q=p[1], d=p[0];
    if(p <= q-2){
        counter++;
    }
}
print(counter);

var r= +readline();
var j=0;
for(var i=0; i<r; i++){
    var p= +readline();
    if(p[i+1]-p[i] >= 2){
        j++;
    }
}
print(j);

var r= +readline();
var j=0;
for(var i=0; i<r; i++){
    var p= +readline();
    if((p[i+1]-p[i]) >= 2){
        j++;
    }
}
print(j);

var r= +readline();
var counter=0;
for(var i=0; i<r; i++){
    var p= +readline().split(' '), q=p[1], d=p[0];
    if(p <= q-7){
        counter++;
    }
}
print(counter);

var r= +readline();
var counter=0;
for(var i=0; i<r; i++){
    var p= +readline().split(' '), q=p[1], d=p[0];
    if(p <= q-2){
        counter++;
    }
}
print(counter);

var r= +readline();
var j=0;
for(var i=0; i<r.length; i++){
    var p= +readline();
    if(p[i+1]-p[i] >= 2){
        j++;
    }
}
print(j);

var r=+readline();
var j=0;
for(var i=0;i<r;i++){
    var p=readline();
    if(p[i+1]-p[i] >= 2){
        j++;
    }
}
print(j);

var r = +readline();
var counter = 0;
for(i=0; i < r; i++){
    var p= +readline().split(" "), q=+p[1], d=+p[0];
    if((q-d) >= 2){
        counter++;
    }
}
print(counter);

var r=+readline();
var j=0;
for(var i=0;i<r;i++){
    var p=readline();
    if((p[i+1]-p[i]) >= 2){
        j++;
    }
}
print(j);

var r=+readline();
var j=0;
for(var i=0;i<r;i++){
    var p=+readline().split(' ');
    var q=+p[1];
    var d=+p[0];
    if((q-d) >= 2){
        j++;
    }
}
print(j);

var r= +readline();
var j=0;
for(var i=0; i<r; i++){
    var p= +readline();
    if(p[i]-p[i+1] >= 2){
        j++;
    }
}
print(j);

var r= +readline();
var counter=0;
for(var i=0; i<r; i++){
    var p= +readline().split(' '), q=p[1], d=p[0];
    if((q-d) >= 2){
        counter++;
    }
}
print(counter);

var r= +readline();
var p= +readline();
var j=0;
for(var i=0; i<r; i++){
    if(p[i+1]-p[i] >= 2){
        j++;
    }
}
print(j);

var r = +readline(), p, q, d, counter = 0;
for(i=0; i < r; i++){
    p = +readline().split(" ");
    q = +p[1];
    d = +p[0];
    if((q-d) >= 2){
        counter++;
    }
}
write(counter);

var r= +readline();
var p= +readline();
var j=0;
for(var i=0; i<r; i++){
    if((p[i+1]-p[i]) >= 2){
        j++
    }
}
print(j);

var r= +readline();
var counter=0;
for(var i=0; i<r; i++){
    var p= +readline().split(" "), q=+p[1], d=+p[0];
    if((q-d) >= 2){
        counter++;
    }
}
print(counter);

var r = +readline(), p, q, d, count = 0;
for(i=0; i < r; i++){
    p = +readline().split(" ");
    q = +p[1];
    d = +p[0];
    if((q-d) >= 2){
        count++;
    }
}
write(count);

var r= +readline();
var j=0;
for(var i=0; i<r; i++){
    var p= +readline();
    if((p[i+1]-p[i]) >= 2){
        j++
    }
}
print(j);

m=readline()
sum=0
for(i=0;i<m;i++)
{
   r=readline().split(' ')
   if(parseInt(r[0])<parseInt(r[1])-2 )
       sum=sum+1

}
print(sum)

var n = readline();
var s = [];
for (var i = 0; i < n; i++)
    s.push(readline().split());
var count = 0;

for (var i = 0; i < n; i++)
    if ((s[i][1] - s[i][0]) >= 2)
        count++;
print(count);

var n = readline();
var s = [];
for (var i = 0; i < n; i++)
    s.push(readline().split());
var count = 0;
for (var i = 0; i < n; i++)
    if ((s[i][1] - s[i][0]) >= 2)
        count++;
print(count);

var n = parseInt(readline());
var s = [];
for (var i = 0; i < n; i++)
    s.push(readline().split());
var count = 0;
for (var i = 0; i < n; i++)
    if ((parseInt(s[i][1]) - parseInt(s[i][0])) >= 2)
        count++;
print(count);

var n = parseInt(readline());
var freeroom = 0;

for(var i = 0; i < n; i++)
{
	var pq = readline().split(' ');
	if((parseInt(pq[0]) + 2) >= parseInt(pq[1]))
		freeroom++;
}

print(freeroom);

var n = parseInt(readline());
var freeroom = 0;

for(var i = 0; i < n; i++)
{
	var pq = readline();
	if((parseInt(pq[0]) + 2) >= parseInt(pq[1]))
		freeroom++;
}

print(freeroom);

var n = parseInt(readline());
var freeroom = 0;

for(var i = 0; i < n; i++)
{
	var pq = readline().split(' ');
	if((parseInt(pq[1]) - parseInt(pq[1])) >= 2)
		freeroom++;
}

print(freeroom);

var str1 = readline().split(" ");
var str2 = readline().split(" ");
print (str2);

var n =readline();
var room = [];
var str1 = " ";
for (i=1;i<=n;i++) room.push(readline());
print (room);

var str1 = readline().split(" ");
var str2 = readline();
print (str2);

var n  = readline();
var str = readline().split(" ");// 3;
//var b = +str[1];
var room = 0;
	for (var i=0; i<+n; i++){

			if(+str[1]-2>=+str[0])
			room++;
	}
print(room);


// Generated by CoffeeScript 1.4.0
(function() {
  var UniAccel, a, d, l, r, sa, sc, sd, sf, su, sv, sw, td, tf, tu, v, vb, w, _ref, _ref1;

  UniAccel = {
    vel_change_disp: function(v0, v1, a) {
      return (v1 * v1 - v0 * v0) / (2 * a);
    },
    disp_time: function(s, v0, a) {
      return (Math.sqrt(v0 * v0 + 2 * a * s) - v0) / a;
    }
  };

  _ref = readline().split(' ').map(function(x) {
    return parseInt(x);
  }), a = _ref[0], v = _ref[1];

  _ref1 = readline().split(' ').map(function(x) {
    return parseInt(x);
  }), l = _ref1[0], d = _ref1[1], w = _ref1[2];

  sw = UniAccel.vel_change_disp(0, w, a);

  sv = UniAccel.vel_change_disp(0, v, a);

  if (w > v || sw >= d) {
    if (sv > l) {
      print(UniAccel.disp_time(l, 0, a).toFixed(5));
    } else {
      print((v / a + (l - sv) / v).toFixed(5));
    }
  } else {
    sf = UniAccel.vel_change_disp(w, v, a);
    tf = 0;
    r = l - d;
    if (sf > r) {
      tf = UniAccel.disp_time(r, w, a);
    } else {
      tf = UniAccel.disp_time(sf, w, a) + (r - sf) / v;
    }
    su = UniAccel.vel_change_disp(0, v, a);
    sd = UniAccel.vel_change_disp(v, w, -a);
    sa = su + sd;
    if (sa <= d) {
      sc = d - sa;
      tu = UniAccel.disp_time(su, 0, a);
      td = UniAccel.disp_time(sd, v, -a);
      print((tu + sc / v + td + tf).toFixed(5));
    } else {
      vb = Math.sqrt(a * d + (w * w) / 2);
      su = UniAccel.vel_change_disp(0, vb, a);
      sd = UniAccel.vel_change_disp(vb, w, -a);
      tu = UniAccel.disp_time(su, 0, a);
      td = UniAccel.disp_time(sd, vb, -a);
      print((tu + td + tf).toFixed(5));
    }
  }

}).call(this);

line = readline().split(' ');
a = parseInt( line[0] );
v = parseInt( line[1] );
line = readline().split(' ');
l = parseInt( line[0] );
d = parseInt( line[1] );
w = parseInt( line[2] );

function dist(v, t){
	return v*t + a*t*t/2;
}
function travel(distance, speed){
	var tmax = ( Math.sqrt(speed*speed+2*a*distance) - speed )/a;
	var t = (v-speed)/a;
	return tmax>=t ? t+(distance-dist(speed,t))/v : tmax;
}

var tw = w/a;
var dw = dist(0, tw);
if(v<=w||dw>=d){
	print( travel(l, 0) );
}else{
	print( tw + 2*travel(0.5*(d-dw), w)+travel(l-d, w) );
}

// Generated by CoffeeScript 1.4.0
(function() {
  var UniAccel, a, d, l, sa, sc, sd, sf, su, sv, sw, td, tf, tu, v, vb, w, _ref, _ref1;

  UniAccel = {
    vel_change_disp: function(v0, v1, a) {
      return (v1 * v1 - v0 * v0) / (2 * a);
    },
    disp_time: function(s, v0, a) {
      return (Math.sqrt(v0 * v0 + 2 * a * s) - v0) / a;
    }
  };

  _ref = readline().split(' ').map(function(x) {
    return parseInt(x);
  }), a = _ref[0], v = _ref[1];

  _ref1 = readline().split(' ').map(function(x) {
    return parseInt(x);
  }), l = _ref1[0], d = _ref1[1], w = _ref1[2];

  sw = UniAccel.vel_change_disp(0, w, a);

  sv = UniAccel.vel_change_disp(0, v, a);

  if (w > v || sw >= d) {
    if (sv > l) {
      print(UniAccel.disp_time(l, 0, a).toFixed(5));
    } else {
      print((v / a + (l - sv) / v).toFixed(5));
    }
  } else {
    sf = UniAccel.vel_change_disp(w, v, a);
    tf = UniAccel.disp_time(sf, w, a) + (l - d - sf) / v;
    su = UniAccel.vel_change_disp(0, v, a);
    sd = UniAccel.vel_change_disp(v, w, -a);
    sa = su + sd;
    if (sa <= d) {
      sc = d - sa;
      tu = UniAccel.disp_time(su, 0, a);
      td = UniAccel.disp_time(sd, v, -a);
      print((tu + sc / v + td + tf).toFixed(5));
    } else {
      vb = Math.sqrt(a * d + (w * w) / 2);
      su = UniAccel.vel_change_disp(0, vb, a);
      sd = UniAccel.vel_change_disp(vb, w, -a);
      tu = UniAccel.disp_time(su, 0, a);
      td = UniAccel.disp_time(sd, vb, -a);
      print((tu + td + tf).toFixed(5));
    }
  }

}).call(this);

// Generated by CoffeeScript 1.4.0
(function() {
  var UniAccel, a, d, l, r, sa, sc, sd, sf, su, sv, sw, td, tf, tu, v, vb, w, _ref, _ref1;

  UniAccel = {
    vel_change_disp: function(v0, v1, a) {
      return (v1 * v1 - v0 * v0) / (2 * a);
    },
    disp_time: function(s, v0, a) {
      return (Math.sqrt(v0 * v0 + 2 * a * s) - v0) / a;
    }
  };

  _ref = readline().split(' ').map(function(x) {
    return parseInt(x);
  }), a = _ref[0], v = _ref[1];

  _ref1 = readline().split(' ').map(function(x) {
    return parseInt(x);
  }), l = _ref1[0], d = _ref1[1], w = _ref1[2];

  sw = UniAccel.vel_change_disp(0, w, a);

  sv = UniAccel.vel_change_disp(0, v, a);

  if (w > v || sw >= d) {
    if (sv > l) {
      print(1);
      print(UniAccel.disp_time(l, 0, a).toFixed(5));
    } else {
      print(2);
      print((v / a + (l - sv) / v).toFixed(5));
    }
  } else {
    sf = UniAccel.vel_change_disp(w, v, a);
    tf = 0;
    r = l - d;
    if (sf > r) {
      tf = UniAccel.disp_time(r, w, a);
    } else {
      tf = UniAccel.disp_time(sf, w, a) + (r - sf) / v;
    }
    su = UniAccel.vel_change_disp(0, v, a);
    sd = UniAccel.vel_change_disp(v, w, -a);
    sa = su + sd;
    if (sa <= d) {
      print(3);
      sc = d - sa;
      tu = UniAccel.disp_time(su, 0, a);
      td = UniAccel.disp_time(sd, v, -a);
      print((tu + sc / v + td + tf).toFixed(5));
    } else {
      print(4);
      vb = Math.sqrt(a * d + (w * w) / 2);
      su = UniAccel.vel_change_disp(0, vb, a);
      sd = UniAccel.vel_change_disp(vb, w, -a);
      tu = UniAccel.disp_time(su, 0, a);
      td = UniAccel.disp_time(sd, vb, -a);
      print((tu + td + tf).toFixed(5));
    }
  }

}).call(this);

// Generated by CoffeeScript 1.4.0
(function() {
  var UniAccel, a, d, l, sa, sc, sd, su, sv, sw, td, tf, tu, v, vb, w, _ref, _ref1;

  UniAccel = {
    vel_change_disp: function(v0, v1, a) {
      return (v1 * v1 - v0 * v0) / (2 * a);
    },
    disp_time: function(s, v0, a) {
      return (Math.sqrt(v0 * v0 + 2 * a * s) - v0) / a;
    }
  };

  _ref = readline().split(' ').map(function(x) {
    return parseInt(x);
  }), a = _ref[0], v = _ref[1];

  _ref1 = readline().split(' ').map(function(x) {
    return parseInt(x);
  }), l = _ref1[0], d = _ref1[1], w = _ref1[2];

  sw = UniAccel.vel_change_disp(0, w, a);

  sv = UniAccel.vel_change_disp(0, v, a);

  if (w > v || sw >= d) {
    if (sv > l) {
      print(UniAccel.disp_time(l, 0, a).toFixed(5));
    } else {
      print((v / a + (l - sv) / v).toFixed(5));
    }
  } else {
    tf = UniAccel.disp_time(l - d, w, a);
    su = UniAccel.vel_change_disp(0, v, a);
    sd = UniAccel.vel_change_disp(v, w, -a);
    sa = su + sd;
    if (sa <= d) {
      sc = d - sa;
      tu = UniAccel.disp_time(su, 0, a);
      td = UniAccel.disp_time(sd, v, -a);
      print((tu + sc / v + td + tf).toFixed(5));
    } else {
      vb = Math.sqrt(a * d + (w * w) / 2);
      su = UniAccel.vel_change_disp(0, vb, a);
      sd = UniAccel.vel_change_disp(vb, w, -a);
      tu = UniAccel.disp_time(su, 0, a);
      td = UniAccel.disp_time(sd, vb, -a);
      print((tu + td + tf).toFixed(5));
    }
  }

}).call(this);


var n = Number(readline());
var a = readline().split(' ').map(Number);
var c = [0, 0];
for (var i = 0; i < n; i++) {
    if (a[i] % 2 === 0) c[0]++;
    else c[1]++;
}
if (c[1] % 2 === 0) {
    print(c[0]);
} else {
    print(c[1]);
}

"use strict";

var n = readline();
var a = readline().split(' ').map(Number);
var sum = 0, even = 0;
for(var i = 0; i < n; i++) {
    sum += a[i];
    if (a[i] % 2 === 0) { even++; }
}
if (sum % 2 === 0) {
    print(even);
} else {
    print(n - even);
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  const arr = d.split(' ').map(Number);
  let sum = arr.reduce((a, b) => a + b, 0);
  let ans = 0;

  arr.forEach(x => (sum - x) % 2 === 0 && ans++);

  console.log(ans);

  c++;
});

readline();
var a=readline().split(' ').map(Number);
var p=a.reduce(function(a,b){return a+b;})%2;
print(a.filter(function(v){return v%2===p;}).length);

;(function () {

	var n = +readline();
	if (n == 1) {
		print(1);
		return;
	}

	var p = readline().split(' ');
	var s = p.reduce(function (p, e) { return p + +e; }, 0);

	var x = 0;
	p.forEach(function (e) {
		if (! ((s - e) % 2)) x++;
	});

	print(x);

}).call(this);

var limit = readline()
var values = readline().split(" ")
var sum = 0;
var count = 0;
for(var i = 0; i < values.length; i++){
    sum += parseInt(values[i])
}

for(var i = 0; i < values.length; i++){
    if((sum - parseInt(values[i])) % 2 == 0){
        count++
    }
}

print(count)

n = +readline();
a = readline().split(' ').map(Number);

tot = 0 ;
for (i = 0 ; i < n ; i ++)
{
    tot += a[i];
}
var res = 0;
for (var i = 0 ; i < n ; i ++)
{
    rem = tot - a[i];
    if (rem % 2 === 0 )
    {
        res ++;
    }
}
write(res);

n = +readline();
a = readline().split(' ').map(Number);
write(a);

tot = 0 ;
for (i = 0 ; i < n ; i ++)
{
    tot += a[i];
}
var res = 0;
for (var i = 0 ; i < n ; i ++)
{
    rem = tot - a[i];
    if (rem % 2 === 0 )
    {
        res ++;
    }
}
write(res);

n = +readline();
a = readline().split(' ').map(parseInt);

tot = 0 ;
for (i = 0 ; i < n ; i ++)
{
    tot += a[i];
}
var res = 0;
for (var i = 0 ; i < n ; i ++)
{
    rem = tot - a[i];
    if (rem % 2 === 0 )
    {
        res ++;
    }
}
write(res);


const balance = s => {
  let res = 0
  for (let i = 0; i < s.length; i++) {
    res += s[i] === '1' ? -1 : 1
  }
  return res
}

const processData = (lines) => {
  const count = lines[0]

  for (i = 0; i < count; i++){
    let money = +lines[i + 1]
    let res = money
    while(money >= 10) {
      const cacheback = Math.floor(money/10)
      money -= cacheback * 10
      money += cacheback
      res += cacheback
    }
    console.log(res)
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})

var n = readline();
var results = [];
var s, remainder, sum;

for (var i=0; i<n; i++) {
    s = +readline();
    sum = 0;
    while (s >= 10) {
        remainder = s%10;
        sum += s - remainder;
        s = Math.floor(s/10) + remainder;
    }
    sum += s;
    print(sum);
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

let input = ''
let ptr = 0
process.stdin.on('data', (i) => {
  input += i
})

process.stdin.on('end', () => {
  input = input.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main()
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if (inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt() {
  return parseInt(input[ptr++])
}

function readString() {
  return input[ptr++]
}

function readStrings() {
  return input[ptr++].split(' ')
}

function readInts() {
  return input[ptr++].split(' ').map(a => parseInt(a))
}

function main() {
  let t = readInt()
  while(t--) {
    let s = readInt()
    if(s < 10) wr(s)
    else {
      let x = 0
      while(s >= 10) {
        x += Math.floor(s / 10) * 10
        s = Math.floor(s / 10) + s % 10
        // wr(x, s)
      }
      wr(x + s)
    }
  }
}

function processData(input) {
	//Enter your code here
	var data = input
		.trim()
		.split("\n")
		.map(a => parseInt(a));
	// console.log(data)
	var tcs = data[0];
	for (var i = 1; i <= tcs; i++) {
		let num = data[i];
		var sum = num;
		var res = foodBuy(num);
		console.log(res);
	}

	function foodBuy(num) {
		var num1 = Math.floor(num / 10) + (num % 10);
		sum = sum + Math.floor(num / 10);
		if (num < 10) {
			return sum;
		} else {
			return foodBuy(num1);
		}
		return sum;
	}
}

process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function(input) {
	_input += input;
});

process.stdin.on("end", function() {
	processData(_input);
});

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let ans = '';

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  let n = +d;
  let curr = 0;
  let add = 0;

  while (n > 0) {
    curr += n;
    add += n % 10;
    n = Math.floor(n / 10);
  }

  let [x, y] = (add / 10).toString().split('.').map(Number);

  if (x + y >= 10) {
    add = Math.ceil(add / 10);
  }
  else {
    add = Math.floor(add / 10);
  }

  ans += `${curr + add}\n`;

  c++;
});

rl.on('close', () => {
  console.log(ans);
});

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

let n = (m = remainingLines = remainingTestCount = lineNumber = lineCount = 0);

// Some utitls
const utils = {};
utils.doOnEachLine = (line) => {
  let s = Number(line);
  let a = s;
  let n = 0;

  while (a >= 10) {
    x = Math.floor(a / 10);
    n += x;
    a = x + (a % 10);
  }

  console.log(n + s);
};

rl.on('line', async (line) => {
  // Getting Inputs: Type one
  try {
    lineNumber++;
    if (lineNumber === 1) {
      lineCount = Number(line);
      return;
    }
    utils.doOnEachLine(line);
  } catch (e) {
    console.log(e.message);
    console.log(e.stack);
  }
});

const readline = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout,
});

const input = [];
readline.on('line', x => input.push(x));

readline.on('close', () => {
    const n = parseInt(input[0]);

    for (let i = 1; i <= n; i++) {
        let sum = parseInt(input[i]);
        let tog = 0;
        for (let j = 10 ** 9; j >= 10; j /= 10) {
            if(Math.trunc(sum / j) >= 1) {
                let spent = j * Math.trunc(sum / j);
                let cashback = spent / 10;
                sum = sum - spent + cashback;
                tog += spent;
                if (sum / j >= 1) {
                    j *= 10;
                }
            } else {
                continue;
            }
        }

        tog += sum;
        console.log(tog);
    }
});

'use strict'

let t = parseInt(readline())
while (t --> 0) {
  let n = parseInt(readline())
  let ans = 0

  while (n >= 10) {
    const r = parseInt(n / 10)
    ans += r * 10
    n = parseInt(n % 10) + r
  }
  print(ans + n)
}

'use strict'

const problem = (s) => {
    let r = 0, x;
    while (s >= 10) {
        r += (x = s/10|0);
        s -= 9*x;
    }
    return r*10 + s;
}

let t = +readline();
while(t--) print(problem(+readline()));

Main();
function myout(t){print(t);}//standard output
function next(){return readline();}
//[no]param
//不明値:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
//8:半角SPで結合　9:改行で結合　0:文字なしで結合
function myconv(i,no){switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}
function Main() {
    var t = myconv(next(),1);
    var output = new Array(t);
    for(var i = 0; i < t; i++){
        var N = myconv(next(),1);
        var tmp = 0;
        while(true){
            if(N < 10){
                tmp += N;
                break;
            }
            var nokori = (N % 10);
            var add = N - nokori;
            tmp += add;
            N = nokori + (add / 10);
        }
        output[i] = tmp;
    }
    myout(myconv(output,9));
}

'use strict'

let t = parseInt(readline())
while (t --> 0) {
  const n = parseInt(readline())
  let ans = 0
  let n2 = n
  while (n2 > 0) {
    ans += parseInt(n2 / 10)
    n2 /= 10
  }

  print(parseInt(ans + n))
}

'use strict'

let t = parseInt(readline())
while (t --> 0) {
  const n = parseInt(readline())
  let ans = 0
  let n2 = n
  while (n2 > 0) {
    ans += parseInt(n2 / 10)
    n2 = parseInt(n2 / 10)
  }

  print(parseInt(ans + n))
}

'use strict'

let t = parseInt(readline())
while (t --> 0) {
  const n = parseInt(readline())
  let ans = 0
  let n2 = n
  while (n2 > 0) {
    ans += n2 / 10
    n2 /= 10
  }

  print(parseInt(ans + n))
}

var n = readline();
var results = [];
var s, remainder, sum;

for (var i=0; i<n; i++) {
    s = readline();
    sum = 0;
    while (s >= 10) {
        remainder = s%10;
        sum += s - remainder;
        s = Math.floor(s/10) + remainder;
    }
    sum += s;
    print(sum);
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let ans = '';

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  let n = +d;
  let inc = 0;
  let prev = 0;
  let curr = 0;

  while (n > 0) {
    curr += n;
    let r = curr % 10;

    if (r < prev) {
      inc++;
    }

    prev = r;

    n = Math.floor(n / 10);
  }

  ans += `${curr + inc}\n`;

  c++;
});

rl.on('close', () => {
  console.log(ans);
});

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  if (c % 2 !== 0) {
    c++;
    return;
  }

  const arr = d.split(' ').map(Number);
  let sum = 0;

  let isOdd = false;
  let isEven = false;
  for (let i = 0; i < arr.length; i++) {
    sum += arr[i];

    if (arr[i] % 2 === 0) {
      isEven = true;
    }
    else {
      isOdd = true;
    }
  }

  if (sum % 2 !== 0 || (isEven && isOdd)) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }

  // let ans = 'NO';
  // let sum = 0;

  // for (let i = 0; i < arr.length; i++) {
  //   sum += arr[i];

  //   for (let j = 0; j < arr.length; j++) {
  //     if ((arr[i] + arr[j]) % 2 !== 0) {
  //       ans = 'YES';
  //       break;
  //     }
  //   }
  // }

  // if (sum % 2 !== 0) {
  //   ans = 'YES';
  // }

  // console.log(ans);

  c++;
});

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let ans = '';

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  let n = +d;
  let inc = 0;
  let prev = 0;
  let curr = 0;
  let r = 0;

  while (n > 0) {
    curr += n;
    r = curr % 10;

    if (r < prev) {
      inc++;
    }

    prev = r;

    n = Math.floor(n / 10);
  }

  if (r < prev) {
    inc++;
  }

  ans += `${curr + inc}\n`;

  c++;
});

rl.on('close', () => {
  console.log(ans);
});

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let ans = '';

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  let n = +d;
  let curr = 0;
  let add = 0;

  while (n > 0) {
    curr += n;
    add += n % 10;
    n = Math.floor(n / 10);
  }

  ans += `${curr + Math.floor(add / 10)}\n`;

  c++;
});

rl.on('close', () => {
  console.log(ans);
});

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

let n = (m = remainingLines = remainingTestCount = lineNumber = lineCount = 0);

// Some utitls
const utils = {};
utils.doOnEachLine = (line) => {
  let s = Number(line);
  let n = 0;

  n = Math.floor(s / 9);

  console.log(s + n);
};

rl.on('line', async (line) => {
  // Getting Inputs: Type one
  try {
    lineNumber++;
    if (lineNumber === 1) {
      lineCount = Number(line);
      return;
    }
    utils.doOnEachLine(line);
  } catch (e) {
    console.log(e.message);
    console.log(e.stack);
  }
});

function processData(input) {
	//Enter your code here
	var data = input.trim().split("\n").map(a => parseInt(a));
	// console.log(data);

	var tcs = data[0];
	for (var i = 1; i <= tcs; i++) {
		let num = data[i];
		var sum = num;
		var res = foodBuy(num);
		console.log(res);
	}

	function foodBuy(num) {
		var num1 = Math.floor(num / 10) + (num % 10);

		if (num <10) {
			sum = num;
			return sum;
		}
		else if (Math.floor(num / 10) == 1 && num1 < 10) {
			sum = sum + Math.floor(num / 10);
			return sum;
		} else {
			// num = Math.floor(num/10)+num%10
			sum = sum + Math.floor(num / 10);
			// console.log(sum)
			return foodBuy(num1);
		}
		return sum;
	}
}

process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function(input) {
	_input += input;
});

process.stdin.on("end", function() {
	processData(_input);
});

function processData(input) {
	//Enter your code here
	var data = input.split("\n").map(a => parseInt(a));
	console.log(data);

	var tcs = data[0];
	for (var i = 1; i <= tcs; i++) {
		let num = data[i];
		var sum = num;
		var res = foodBuy(num);
		console.log(res);
	}

	function foodBuy(num) {
		var num1 = Math.floor(num / 10) + (num % 10);

		if (num == 1) {
			sum = 1;
			return sum;
		}
		if (Math.floor(num / 10) == 1 && num1 < 10) {
			sum = sum + Math.floor(num / 10);
			return sum;
		} else {
			// num = Math.floor(num/10)+num%10
			sum = sum + Math.floor(num / 10);
			// console.log(sum)
			return foodBuy(num1);
		}
		return sum;
	}
}

process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function(input) {
	_input += input;
});

process.stdin.on("end", function() {
	processData(_input);
});


"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}

function stringArr1() {
  return readline().trim().split(" ");
}
function getValue() {
  return parseInt(readline());
}
let mod = 1e9 + 7;
mod = BigInt(mod);
const pow = (num, exp, mod) => {
  if (exp === BigInt(0)) return BigInt(1);
  let x = pow(num, exp / BigInt(2), mod);
  if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;
  else return (x * x) % mod;
};
const inverse = (num, exp) => {
  return pow(BigInt(num), BigInt(exp), BigInt(mod));
};
const solve = () => {
  let t = getValue();
  while (t--) {
    let arr = stringArr();
    let dp = new Array(arr.length).fill(Infinity);
    let obj = {};
    dp[0] = 1;
    obj[arr[0]] = 0;
    for (let i = 1; i < arr.length; i++) {
      if (obj[arr[i]] !== undefined) {
        let k = obj[arr[i]];
        let j = k - 1 < 0 ? 0 : dp[k - 1];
        dp[i] = Math.min(dp[i], j + (i - k - 1));
      }
      dp[i] = Math.min(dp[i], dp[i - 1] + 1);
      obj[arr[i]] = i;
    }
    console.log(dp[arr.length - 1]);
  }
};
solve();

'use strict'; /*jslint node:true, browser:true, es6:true*/
const print = console.log
const E = {};
const lines = []
if (!process.env.JEST_WORKER_ID){
  const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })
  rl.on('line', line => {
      lines.push(line);
  });
  rl.on('close', main)
}
let rli = 0;
function readline() {
    return lines[rli++];
}

module.exports = E;

const ra = ()=>readline().split(' ').map(a=>+a)

const EPS = 1e-6;

const calc = (s)=>{
  let d = new Map();
  let prev_pos = new Map();
  for (let i=0; i<s.length; i++){
    let ch = s[i];
    let ans = d.get(i-1)||0;
    let pos = prev_pos.get(ch);
    if (pos!=undefined){
      let take = (d.get(pos-1)||0) + 2
      if (take>ans)
        ans = take;
    }
    d.set(i, ans)
    prev_pos.set(ch, i);
  }
  return s.length-d.get(s.length-1)
  /**
  const cache_d = new Map();
  const cache_find_prev = new Map();

  const find_prev = (char, until)=>{
    let k = char+';'+until;
    if (cache_find_prev.has(k))
      return cache_find_prev.get(k);
    if (until==0)
      return -1;
    if (s[until-1]==char)
      return until-1;
    let ans = find_prev(char, until-1);
    cache_find_prev.set(k, ans)
    return ans;
  };
  //console.log('S\n', s)

  const d = (len)=>{
    if (len<2)
      return 0;
    if (cache_d.has(len))
      return cache_d.get(len);
    let char = s[len-1];
    let not_take = d(len-1);
    let prev_pos = find_prev(char, len-1);
    //console.log('find_prev', char, len-1, {prev_pos})
    if (prev_pos==-1)
      return not_take;
    let take = d(prev_pos)+2;
    let ans = Math.max(not_take, take);
    cache_d.set(len, ans);
    return ans;
  };
  let len = d(s.length);
  //console.log(cache_d)
  return s.length-len;
  **/
};

function main() {
    let T = +readline();
    while (T--){
      let s = readline();
      print(calc(s))
    }
}

E.calc = calc;

let readline = require('readline');
let rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let input = [];
let takeInput = async function () {
  rl.on('line', function (line) {
    input.push(line);
  });
}
takeInput();
numberOfline = 0;
nextString = () =>{
  return input[numberOfline++];
}
nextInt = () => {
  return parseInt(input[numberOfline++], 10);
}
nextArrayOfInt = () => {
  let str = input[numberOfline++];
   return str.split(' ').map((val) => {
    return parseInt(val);
  });
}
nextFloat = () => {
  return parseFloat(input[numberOfline++]);
}
intDiv = (val, div) => {
  return (val - val % div) / div;
}

let main = () => {
  let test = 1;
  test = nextInt();
  while (test--){
    solve()
  }

}

let solve = () => {
  let str = String(nextString());
  const mp = new Map();
  let ans = 0;
  let n = str.length;

  for (i = 0; i < n; i++){
    if (mp.has(str.charAt(i))){
      mp.clear();
      ans--;
    }
    else{
      ans++;
      mp.set(str.charAt(i), 1);
    }

  }
  console.log(ans);

}
rl.on('close', main);

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
function readLine() {
    return inputString[currentLine++];
};
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
    // cmd(not powershell): node cp.js < input.txt
});

function main() {
    let t = parseInt(readLine());
    while (t-- > 0) {
        console.log(solve());
    }
}
function solve() {
    let s = readLine();
    let size = s.length;
    let arr = new Array(26).fill(false), m = 0;
    for (let i = 0; i < size; i++) {
        let ind = s.charCodeAt(i) - 97;
        if (arr[ind]) {
            m += 2;
            arr = arr.map(i => false);
        } else {
            arr[ind] = true;
        }
    }
    return size - m;
}

const fs = require('fs')
const inputs = fs.readFileSync(0, 'utf-8').split('\n')

const n = Number(inputs[0])

main(n, inputs)

function main(_, lines) {
  let res = []
  for (let i = 1; i <= _; i++) {
    let ans = 0
    const str = lines[i].trim()
    const set = new Set()
    for (let char of str) {
      if (set.has(char)) {
        ans += set.size - 1
        set.clear()
      } else {
        set.add(char)
      }
    }
    res.push(ans + set.size)
  }

  console.log(res.join('\n'))
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const str = lines[l++]
        output[i] = solve(str)
    }
    console.log(output.join('\n'))
// })()
})

function solve(str) {
    const last = {}
    const dp = Array(str.length)
    for (let i = 0; i < str.length; i++) {
        const ch = str[i]
        const del = (dp[i - 1] || 0) + 1
        if (ch in last) {
            const prev = last[ch]
            dp[i] = Math.min(del, (dp[prev - 1] || 0) + i - prev - 1)
        } else {
            dp[i] = del
        }
        //
        last[ch] = i
    }
    // console.log(dp)
    return dp[str.length - 1]
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}

function stringArr1() {
  return readline().trim().split(" ");
}
function getValue() {
  return parseInt(readline());
}
let mod = 1e9 + 7;
mod = BigInt(mod);
const pow = (num, exp, mod) => {
  if (exp === BigInt(0)) return BigInt(1);
  let x = pow(num, exp / BigInt(2), mod);
  if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;
  else return (x * x) % mod;
};
const inverse = (num, exp) => {
  return pow(BigInt(num), BigInt(exp), BigInt(mod));
};
const solve = () => {
  let t = getValue();
  while (t--) {
    let arr = stringArr();
    let dp = [],
      obj = {};
    dp[0] = 1;
    obj[arr[0]] = 0;
    for (let i = 1; i < arr.length; i++) {
      if (obj[arr[i]] === undefined) dp[i] = dp[i - 1] + 1;
      else {
        let k = obj[arr[i]];
        let j = k - 1 < 0 ? 0 : dp[k - 1];
        dp[i] = j + (i - k - 1);
      }
      obj[arr[i]] = i;
    }
    console.log(dp[arr.length - 1]);
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}

function stringArr1() {
  return readline().trim().split(" ");
}
function getValue() {
  return parseInt(readline());
}
let mod = 1e9 + 7;
mod = BigInt(mod);
const pow = (num, exp, mod) => {
  if (exp === BigInt(0)) return BigInt(1);
  let x = pow(num, exp / BigInt(2), mod);
  if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;
  else return (x * x) % mod;
};
const inverse = (num, exp) => {
  return pow(BigInt(num), BigInt(exp), BigInt(mod));
};
const solve = () => {
  let t = getValue();
  while (t--) {
    let arr = stringArr();
    let dp = [],
      ans = arr.length,
      obj = {};
    dp[0] = 1;
    obj[arr[0]] = 0;
    for (let i = 1; i < arr.length; i++) {
      if (obj[arr[i]] === undefined) dp[i] = dp[i - 1] + 1;
      else {
        let k = obj[arr[i]];
        let j = k - 1 < 0 ? 0 : dp[k - 1];
        dp[i] = j + (i - k - 1);
      }
      ans = Math.min(ans, dp[i] + arr.length - i - 1);
      obj[arr[i]] = i;
    }
    console.log(ans);
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}

function stringArr1() {
  return readline().trim().split(" ");
}
function getValue() {
  return parseInt(readline());
}
let mod = 1e9 + 7;
mod = BigInt(mod);
const pow = (num, exp, mod) => {
  if (exp === BigInt(0)) return BigInt(1);
  let x = pow(num, exp / BigInt(2), mod);
  if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;
  else return (x * x) % mod;
};
const inverse = (num, exp) => {
  return pow(BigInt(num), BigInt(exp), BigInt(mod));
};
const solve = () => {
  let t = getValue();
  while (t--) {
    let arr = stringArr();
    let obj = {};
    for (let i = 0; i < arr.length; i++) {
      if (obj[arr[i]] === undefined) obj[arr[i]] = [i];
      else obj[arr[i]].push(i);
    }
    const isAvl = (val, pos, end) => {
      let arr = obj[val];
      if (arr.length === 1) return false;
      for (let i = 0; i < arr.length; i++)
        if (arr[i] > pos && arr[i] <= end) return arr[i];
      return false;
    };
    const helper = (st, end) => {
      let ans = 0;
      while (st <= end) {
        if (arr[st] === arr[st + 1]) {
          st += 2;
          continue;
        }
        let k = isAvl(arr[st], st, end);
        if (k === false) {
          ans++;
          st++;
        } else {
          if (k - st - 1 <= 2) {
            ans += k - st - 1;
            st = k + 1;
          } else {
            let j = helper(st + 1, k - 1);
            if (j === k - st - 1) {
              ans += k - st - 1;
              st = k + 1;
            } else {
              ans += j + 1;
              st = k;
            }
          }
        }
      }
      return ans;
    };
    console.log(helper(0, arr.length - 1));
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}

function stringArr1() {
  return readline().trim().split(" ");
}
function getValue() {
  return parseInt(readline());
}
let mod = 1e9 + 7;
mod = BigInt(mod);
const pow = (num, exp, mod) => {
  if (exp === BigInt(0)) return BigInt(1);
  let x = pow(num, exp / BigInt(2), mod);
  if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;
  else return (x * x) % mod;
};
const inverse = (num, exp) => {
  return pow(BigInt(num), BigInt(exp), BigInt(mod));
};
const solve = () => {
  let t = getValue();
  while (t--) {
    let arr = stringArr();
    let obj = {};
    for (let i = 0; i < arr.length; i++) {
      if (obj[arr[i]] === undefined) obj[arr[i]] = [i];
      else obj[arr[i]].push(i);
    }
    const isAvl = (val, pos, end) => {
      let arr = obj[val];
      if (arr.length === 1) return false;
      for (let i = 0; i < arr.length; i++)
        if (arr[i] > pos && arr[i] < end) return arr[i];
      return false;
    };
    const helper = (st, end) => {
      let ans = 0;
      while (st <= end) {
        if (arr[st] === arr[st + 1]) {
          st += 2;
          continue;
        }
        let k = isAvl(arr[st], st, end);
        if (k === false) {
          ans++;
          st++;
        } else {
          if (k - st - 1 <= 2) {
            ans += k - st - 1;
            st = k + 1;
          } else {
            let j = helper(st + 1, k - 1);
            if (j === k - st - 1) {
              ans += k - st - 1;
              st = k + 1;
            } else {
              ans += j + 1;
              st = k;
            }
          }
        }
      }
      return ans;
    };
    console.log(helper(0, arr.length - 1));
  }
};
solve();