const solve = (s) => {
  s += "!";

  const char = {};
  for (let i = 0; i < s.length; i++) {
    const c = s[i];
    if (!char.hasOwnProperty(c)) {
      char[c] = {
        lastIndex: null,
        used: false,
      };
    }
    char[c].lastIndex = i;
  }

  let res = "";
  let i = 0;
  while (true) {
    if (i === s.length - 1) break;
    if (char[s[i]].used) {
      i++;
      continue;
    }
    if (char[s[i]].lastIndex === i) {
      res += s[i];
      i++;
      continue;
    }
    let j = i;
    let c = s[i];
    let pos = i;
    while (char[s[j]].used || char[s[j]].lastIndex !== j) {
      j++;
    }
    for (let k = i; k <= j; k++) {
      if (!char[s[k]].used && s[k] > c) {
        c = s[k];
        pos = k;
      }
    }
    res += c;
    char[c].used = true;
    i = pos + 1;
  }

  return res;
};

const main = () => {
  let t = readInt();
  while (t--) {
    const s = readLine();
    console.log(solve(s));
  }
};

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) => string.trim());
  main();
});

const readLine = () => {
  return inputString[currentLine++];
};

const readInt = () => {
  return parseInt(inputString[currentLine++]);
};

const readListInt = () => {
  return inputString[currentLine++].split(" ").map((s) => parseInt(s));
};

'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++];
}

// Make a Snippet for the code above this and then write your logic in main();
var mod = 998244353n
var maxN = 10e6 + 1

function main() {
  var x = parseInt(readline())
  //

  Array(parseInt(x)).fill(1).map((t, iii) => {
    // var n = parseInt(readline())
    //   var a = new Array(n)
    //   var marked = new Array(n).fill(false)
    //   var found = new Array(n).fill(false)
    var a = readline().split('').map((x, iii) => {
      return x
    });
// a=a.reverse()
    // console.log(a)
    var object = {}
    for (let i = 0; i < a.length; i++) {
      if (!object[a[i]]) object[a[i]] = 0
      object[a[i]]++
    }
    var mark = {}
    var res = []
    for (let i = 0; i < a.length; i++) {
      object[a[i]]--
      if (!mark[a[i]]) {
        // console.log(a[i],res, object[res[res.length - 1]] > 0, object[res[res.length - 1]] < a[i])
        while (res.length > 0 && object[res[res.length - 1]] > 0 && res[res.length - 1] < a[i]) {
          mark[res[res.length - 1]] = false
          res.pop()
        }
        res.push(a[i])
        mark[a[i]] = true
      }
    }
    console.log(res.join(''))
  })
}

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
let input = [];
rl.on('line', line => {
    input.push(line);
})
rl.on('close', line => {
    var t = Number(input[0]);
    for (let m = 1; m < input.length; m++) {
        function maxStr(str) {
            var set = new Set();
            var temp = new Set();
            for (var i = 0; i < str.length; i++) {
                temp.add(str[i]);
            }
            var size = temp.size;
            function helper(str, set, size) {
                if (size === 0) {
                    return "";
                }
                var first = new Map();
                var last = new Map();
                for (var i = 0; i < str.length; i++) {
                    if (!set.has(str[i])) {
                        if (!first.has(str[i])) {
                            first.set(str[i], i);
                        }
                        last.set(str[i], i);
                    }
                }
                var map = new Map();
                for (var [c1, index1] of first) {
                    var count = 0;
                    for (var [c2, index2] of last) {
                        if (c1 !== c2 && index1 < index2) {
                            count++;
                        }
                    }
                    map.set(c1, count);
                }
                var n = first.size;
                var c;
                var ch;
                for (c = "z".charCodeAt(0); c >= "a".charCodeAt(0); c--) {
                    ch = String.fromCharCode(c);
                    if (map.has(ch) && !set.has(ch) && map.get(ch) >= size - 1) {
                        break;
                    }
                }
                set.add(ch);
                return ch + helper(str.slice(first.get(ch) + 1), set, size - 1);
            }

            return helper(str, set, size);
        }
        console.log(maxStr(input[m]));
    }
})

const solve = (s) => {
  s += "!";

  const char = {};
  for (let i = 0; i < s.length; i++) {
    const c = s[i];
    if (!char.hasOwnProperty(c)) {
      char[c] = {
        lastIndex: null,
        used: false,
      };
    }
    char[c].lastIndex = i;
  }

  let res = "";
  let i = 0;
  while (true) {
    if (i === s.length - 1) break;
    if (char[s[i]].used) {
      i++;
      continue;
    }
    if (char[s[i]].lastIndex === i) {
      res += s[i];
      i++;
      continue;
    }
    let j = i;
    let c = s[i];
    let pos = i;
    while (char[s[j]].used || char[s[j]].lastIndex !== j) {
      j++;
    }
    for (let k = i; k <= j; k++) {
      if (!char[s[k]].used && s[k] > c) {
        c = s[k];
        pos = k;
      }
    }
    res += c;
    char[c].used = true;
    i = Math.max(pos + 1, j);
  }

  return res;
};

const main = () => {
  let t = readInt();
  while (t--) {
    const s = readLine();
    console.log(solve(s));
  }
};

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) => string.trim());
  main();
});

const readLine = () => {
  return inputString[currentLine++];
};

const readInt = () => {
  return parseInt(inputString[currentLine++]);
};

const readListInt = () => {
  return inputString[currentLine++].split(" ").map((s) => parseInt(s));
};

const solve = (s) => {
  const char = {};
  for (let i = 0; i < s.length; i++) {
    const c = s[i];
    if (!char.hasOwnProperty(c)) {
      char[c] = {
        count: 0,
        lastIndex: null,
        used: false,
      };
    }
    char[c].count++;
    char[c].lastIndex = i;
  }
  const remove = new Array(s.length).fill(false);

  let j = 0;
  for (let i = 0; i < s.length; i++) {
    if (char[s[i]].count === 1) {
      char[s[i]].used = true;
      continue;
    }
    if (char[s[i]].used) {
      remove[i] = true;
      continue;
    }
    if (char[s[i]].lastIndex === i) {
      char[s[i]].used = true;
      continue;
    }

    while ((j < s.length && char[s[j]].count > 1) || j < i) j++;

    if (j < s.length) {
      if (s[i] < s[j]) {
        remove[i] = true;
      } else {
        char[s[i]].used = true;
      }
      continue;
    }

    if (s[i] < s[i + 1]) {
      remove[i] = true;
    } else {
      char[s[i]].used = true;
    }
  }

  let res = "";
  for (let i = 0; i < s.length; i++) {
    if (!remove[i]) res += s[i];
  }

  return res;
};

const main = () => {
  let t = readInt();
  while (t--) {
    const s = readLine();
    console.log(solve(s));
  }
};

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) => string.trim());
  main();
});

const readLine = () => {
  return inputString[currentLine++];
};

const readInt = () => {
  return parseInt(inputString[currentLine++]);
};

const readListInt = () => {
  return inputString[currentLine++].split(" ").map((s) => parseInt(s));
};

const solve = (s) => {
  const count = {};
  for (const char of s) {
    if (!count.hasOwnProperty(char)) {
      count[char] = 0;
    }
    count[char]++;
  }
  const remove = new Array(s.length).fill(false);

  for (let i = 0; i < s.length; i++) {
    if (count[s[i]] === 1) continue;
    if (count[s[i]] === 0) {
      remove[i] = true;
      continue;
    }
    if (s[i] < s[i + 1]) {
      remove[i] = true;
      count[s[i]]--;
    } else {
      count[s[i]] = 0;
    }
  }

  let res = "";
  for (let i = 0; i < s.length; i++) {
    if (!remove[i]) res += s[i];
  }

  return res;
};

const main = () => {
  let t = readInt();
  while (t--) {
    const s = readLine();
    console.log(solve(s));
  }
};

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) => string.trim());
  main();
});

const readLine = () => {
  return inputString[currentLine++];
};

const readInt = () => {
  return parseInt(inputString[currentLine++]);
};

const readListInt = () => {
  return inputString[currentLine++].split(" ").map((s) => parseInt(s));
};

'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++];
}

// Make a Snippet for the code above this and then write your logic in main();
var mod = 998244353n
var maxN = 10e6 + 1

function main() {
  var x = parseInt(readline())
  //

  Array(parseInt(x)).fill(1).map((t, iii) => {
    // var n = parseInt(readline())
    //   var a = new Array(n)
    //   var marked = new Array(n).fill(false)
    //   var found = new Array(n).fill(false)
    var a = readline().split('').map((x, iii) => {
      return x
    });
// a=a.reverse()
    // console.log(a)
    var object = {}
    for (let i = 0; i < a.length; i++) {
      if (!object[a[i]]) object[a[i]] = 0
      object[a[i]]++
    }
    var mark = {}
    var res = []
    for (let i = 0; i < a.length; i++) {
      if (!mark[a[i]]) {
        object[a[i]]--
        // console.log(a[i],res, object[res[res.length - 1]] > 0, object[res[res.length - 1]] < a[i])
        while (res.length > 0 && object[res[res.length - 1]] > 0 && res[res.length - 1] < a[i]) {

          mark[res[res.length - 1]] = false
          res.pop()
        }
        res.push(a[i])
        mark[a[i]] = true
      }
    }
    console.log(res.join(''))
  })
}


'use strict';

var readline = require('readline');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);

function solve(n, s) {
  let res = 0,
      len = 0;
  for (let i = 0; i < n;) {
    let j = i;
    while (s[i] === s[j]) {
      j++;
      len++;
    }
    if (len & 1) {
      len = 1;
      res++;
    } else {
      len = 0;
    }
    i = j;
  }
  return res;
}

async function main(read) {
  let t = Number(await read());
  let res = [];
  while (t--) {
    const n = Number(await read());
    const s = await read();
    res.push(solve(n, s));
  }
  console.log(res.join('\n'));
}

const rl = readline__default["default"].createInterface({
  input: process.stdin,
  output: process.stdout
});
void async function () {
  const inputs = [];
  let i = 0;
  for await (const line of rl) {
    inputs.push(line.trim());
  }
  function read() {
    return inputs[i++];
  }
  await main(read);
}();

const lines = [];
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++];
}

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

/*---------------------------------------------------*/

function div(val, by){
    return (val - val % by) / by;
}

const cnk = (n, k) => {
    let res = 1;
    for (let i = 1; i <= k; i++)
        res = res * (n - k + i) / i;
    return Math.round(res + 0.01);
}

const sumab = (a, b) => {
    let x = (b - a + 1);
    let y = a + b;
    if (x % 2 === 0) {
        x = Math.round(x / 2);
    } else {
        y = Math.round(y / 2);
    }
    return BigInt(x) * BigInt(y);
}

/*---------------------------------------------------*/

const calc = (n, s)=>{
    let result = 0;

    for (let i = 0; i < n; i += 2) {
        if (s[i] !== s[i + 1]) result++;
    }

    return result;

    // let segs = [];
    // let length = 1;
    // let cur = s[0];

    // for (let i = 1; i < n; i++) {
    //     if (s[i] !== cur) {
    //         segs.push([length, cur]);
    //         length = 1;
    //         cur = s[i];
    //     } else {
    //         length++;
    //     }
    // }
    // segs.push([length, cur]);
    // console.log(`DEBUG segs`, segs);

    // let m = segs.length;
    // for (let i = 0; i < m; i++) {
    //     let [l, bit] = segs[i];
    //     console.log(`DEBUG i ${i} l ${l} bit`, bit);
    //     if (l % 2 === 0) continue;
    //     let sumSame = 0; let sumDif = 0;
    //     for (let j = i + 1; j < m; j++) {
    //         let [lj, bitj] = segs[j];
    //         console.log(`DEBUG j ${j} lj ${lj} bitj`, bitj);
    //         if (lj % 2 === 0) {
    //             if (bitj === bit) sumSame += lj;
    //             else sumDif += lj;
    //         } else {
    //             if (bitj === bit) {
    //                 result += Math.min(sumDif, sumSame + 2);
    //             } else {
    //                 result += Math.min(sumDif, sumSame) + 1;
    //             }
    //             console.log(`DEBUG result`, result);
    //             i = j;
    //             break;
    //         }
    //     }
    // }

    // return result;
};

function main() {
    let T = +readline();
    let out = [];
    for (let t = 1; t <= T; t++){
        let n = +readline();
        let s = readline();
        // let a = ra();
        out.push(calc(n, s));
        // process.stdout.write(`${calc(n, a)}\n`);
    }
    process.stdout.write(out.join('\n')+'\n');
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

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

function output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let test = 0; test < N; test++) {
        readline();
        let s = readline();
        let curr = s[0];
        let count = 1;
        let isEven = num => num % 2 === 0;

        let ops = 0;

        for (let i = 1; i < s.length; i++) {
            if (s[i] === curr) {
                count++;
            } else {
                if (isEven(count)) {
                    curr = s[i];
                    count = 1;
                } else {
                    ops++;
                    count++;
                }
            }
        }

        output(ops);
    }
}

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 n = +lines[l++]
        const str = lines[l++]
        output[i] = solve(n, str)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, str) {
    let s = -1, p
    const ps = []
    for (let i = 0; i < n; i++) {
        const x = str[i]
        if (x !== p) {
            if (s >= 0) {
                ps.push(str.slice(s, i))
            }
            s = i
            p = x
        }
    }
    if (s < n) {
        ps.push(str.slice(s, n))
    }
// console.log(ps)
    let i = 0
    let ans = 0
    let add = 0
    while (i < ps.length) {
        const x = ps[i].length + add
        if (x & 1) {
            ans++
            add = 1
        } else {
            add = 0
        }
        i++
    }
    return ans
}

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

let lines = 0;

const countSubStrings = (arr, c) => {
  let currentValue = arr[0];
  let subStrings = [0];
  if (arr.length === 1) return 1;
  for (let index = 1; index < arr.length; index++) {
    const element = arr[index];
    if (element !== currentValue) {
      currentValue = element;
      subStrings.push(index);
    }
  }

  return { subStrings };
};

rl.on("line", function (line) {
  if (lines !== 0 && lines % 2 === 0) {
    let input = line.split("").map(Number);
    const { subStrings } = countSubStrings(input);
    console.log(subStrings.filter((x) => x % 2).length);
  }
  lines++;
});

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++];
}

const main = () => {
  let tc = parseInt(readline());
  while(tc--){
    const n = parseInt(readline());
    const s = readline();
    let last = s[0];
    let cnt = 1;
    let ans = 0;
    for(let i = 1; i < n; i++){
      if(s[i] !== last){
        if(cnt%2 !== 0){ // 짝수가 아니면 변경
          ans++;
          cnt++;
        }
        else{
          cnt = 1;
        }
      }
      else{
        cnt++;
      }
      last = s[i];
    }
    console.log(ans);
  }
}

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() {
    readLine();
    let str = readLine();
    let count = 0;
    for (let i = 0; i < str.length; i += 2) {
        if (str[i] !== str[i + 1]) count++;
    }
    return count;
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = nextLong();
		}else if(code == 'double'){
			ret[i] = nextDouble();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');} function nextDoubleArray(size){return nextArray(size, 'double');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());} function nextDouble(){return parseFloat(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
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';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//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 t = nextInt();
	while(hasNext()){
		var N = nextInt();
		var S = next();
		var list = [];
		var c = 1;
		for(var i = 0; i < N - 1; i++){
			if(S[i] == S[i + 1]){
				c++;
			}else{
				list.push(c);
				c = 1;
			}
		}
		list.push(c);
		//myerr(list);
		var output = 0;
		c = 0;
		var odd = false;
		for(var i = 0; i < list.length; i++){
			if(list[i] % 2 == 1){
				if(!odd){
					odd = true;
				}else{
					odd = false;
					output += c + 1;
					c = 0;
				}
			}else{
				if(odd){
					c++;
				}
			}
		}
		myout(output);
	}
}

'use strict';
// HEADER:
const print = console.log;
let IS_MULTITEST, testN;
const pcalc = testN=>{
  let res = calc(testN);
  if (Array.isArray(res)){
    pa(res);
  } else if (Number.isFinite(res) || typeof res=='string'){
    print(res);
  }
};

const main = ()=>{
  if (IS_MULTITEST){
    let T = +readline()
    for (testN=1; testN<=T; testN++)
      pcalc(T);
  } else
   pcalc();
};

const lines = [];
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;
const readline = ()=>lines[rli++];
const L = process.env.DEBUG ? console.log : ()=>{};
const LT = obj=>L(`Test #${testN}`, obj);

const ra = ()=>readline().split(' ').map(a=>+a)
const pa = arr=>print(arr.join(' '));

// SOLUTION:
IS_MULTITEST = 1;

const calc = ()=>{
  // READING:
  let [n] = ra();
  let s = readline();
  LT({n, s});
  // PROCESSING:
  let D = [new Array(n).fill(0), new Array(n).fill(0)];
  let cost = (want, pos)=>+s[pos]==want ? 0 : 1;
  // D[ends with][pos]
  for (let i=1; i<n; i+=2){
    // ends with 1
    let op1 = Math.max((D[1][i-2]||0)+cost(1, i-1)+cost(1, i));
    let op0 = Math.max((D[0][i-2]||0)+cost(1, i-1)+cost(1, i));
    D[1][i] = Math.min(op1, op0);
    // ends with 0
    op1 = Math.max((D[1][i-2]||0)+cost(0, i-1)+cost(0, i));
    op0 = Math.max((D[0][i-2]||0)+cost(0, i-1)+cost(0, i));
    D[0][i] = Math.min(op1, op0);
  }
  return Math.min(D[1][n-1], D[0][n-1]);
};

//import { readline, print } from '@ip-algorithmics/codeforces-io';
var t = +readline();
root: for (var _i = 0, _a = Array.from(Array(t).keys()); _i < _a.length; _i++) {
    var i = _a[_i];
    var n = +readline();
    var a = readline().split('').map(function (v) { return +v; });
    var count = 0;
    for (var i_1 = 0; i_1 < n / 2; i_1++) {
        if (a[i_1 * 2] !== a[i_1 * 2 + 1]) {
            count += 1;
        }
    }
    print(count);
}

const lines = [];
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++];
}

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

/*---------------------------------------------------*/

function div(val, by){
    return (val - val % by) / by;
}

const cnk = (n, k) => {
    let res = 1;
    for (let i = 1; i <= k; i++)
        res = res * (n - k + i) / i;
    return Math.round(res + 0.01);
}

const sumab = (a, b) => {
    let x = (b - a + 1);
    let y = a + b;
    if (x % 2 === 0) {
        x = Math.round(x / 2);
    } else {
        y = Math.round(y / 2);
    }
    return BigInt(x) * BigInt(y);
}

/*---------------------------------------------------*/

const calc = (n, s)=>{
    let result = 0;

    let segs = [];
    let length = 1;
    let cur = s[0];

    for (let i = 1; i < n; i++) {
        if (s[i] !== cur) {
            segs.push([length, cur]);
            length = 1;
            cur = s[i];
        } else {
            length++;
        }
    }
    segs.push([length, cur]);
    // console.log(`DEBUG segs`, segs);

    let m = segs.length;
    for (let i = 0; i < m; i++) {
        let [l, bit] = segs[i];
        // console.log(`DEBUG i ${i} l ${l} bit`, bit);
        if (l % 2 === 0) continue;
        let sumSame = 0; let sumDif = 0;
        for (let j = i + 1; j < m; j++) {
            let [lj, bitj] = segs[j];
            // console.log(`DEBUG j ${j} lj ${lj} bitj`, bitj);
            if (lj % 2 === 0) {
                if (bitj === bit) sumSame += lj;
                else sumDif += lj;
            } else {
                if (bitj === bit) {
                    result += Math.min(sumDif, sumSame + 2);
                } else {
                    result += Math.min(sumDif, sumSame) + 1;
                }
                i = j;
                break;
            }
        }
    }

    return result;
};

function main() {
    let T = +readline();
    let out = [];
    for (let t = 1; t <= T; t++){
        let n = +readline();
        let s = readline();
        // let a = ra();
        out.push(calc(n, s));
        // process.stdout.write(`${calc(n, a)}\n`);
    }
    process.stdout.write(out.join('\n')+'\n');
}

const lines = [];
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++];
}

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

/*---------------------------------------------------*/

function div(val, by){
    return (val - val % by) / by;
}

const cnk = (n, k) => {
    let res = 1;
    for (let i = 1; i <= k; i++)
        res = res * (n - k + i) / i;
    return Math.round(res + 0.01);
}

const sumab = (a, b) => {
    let x = (b - a + 1);
    let y = a + b;
    if (x % 2 === 0) {
        x = Math.round(x / 2);
    } else {
        y = Math.round(y / 2);
    }
    return BigInt(x) * BigInt(y);
}

/*---------------------------------------------------*/

const calc = (n, s)=>{
    let result = 0;

    let segs = [];
    let length = 1;
    let cur = s[0];

    for (let i = 1; i < n; i++) {
        if (s[i] !== cur) {
            segs.push([length, cur]);
            length = 1;
            cur = s[i];
        } else {
            length++;
        }
    }
    segs.push([length, cur]);

    let m = segs.length;
    for (let i = 0; i < m; i++) {
        let [l, bit] = segs[i];
        if (l % 2 === 0) continue;
        let sumSame = 0; let sumDif = 0;
        for (let j = i + 1; j < m; j++) {
            let [lj, bitj] = segs[j];
            if (lj % 2 === 0) {
                if (bitj === bit) sumSame += lj;
                else sumDif += lj;
            } else {
                if (bitj === bit) {
                    result += Math.min(sumDif, sumSame + 2);
                } else {
                    result += Math.min(sumDif, sumSame) + 1;
                }
            }
        }
    }

    return result;
};

function main() {
    let T = +readline();
    let out = [];
    for (let t = 1; t <= T; t++){
        let n = +readline();
        let s = readline();
        // let a = ra();
        out.push(calc(n, s));
        // process.stdout.write(`${calc(n, a)}\n`);
    }
    process.stdout.write(out.join('\n')+'\n');
}


const fs = require("fs");

const input = fs.readFileSync(0, "utf8").trim().split("\n");

const testCases = [];
let T;

function parseInput() {
  T = parseInt(input[0]);
  let index = 0;

  for (let i = 0; i < T; i++) {
    index++;
    const [n, m] = input[index].split(" ").map((item) => parseInt(item));
    index++;
    const a = input[index].split(" ").map((item) => parseInt(item));
    const testCase = {
      n,
      m,
      a,
    };

    testCases.push(testCase);
  }
}

function solution(testCase, index) {
  const { n, m, a } = testCase;

  const sum = a.reduce((acc, val) => acc + val, 0);
  const maxi = Math.max(...a);
  const mini = Math.min(...a);

  let result = sum + maxi - mini + n <= m ? "YES" : "NO";
  console.log(result);
}

parseInput();

testCases.forEach(solution);

const lines = [];
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++];
}

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

function div(val, by){
    return (val - val % by) / by;
}

const calc = (n, m, a)=>{
    if (n >= m) return 'NO';
    a = a.sort((a, b) => a - b);
    let pos = 0;

    for (let i = 1; i < n; i++) {
        pos += a[i] + 1;
        if (pos >= m) {
            return 'NO';
        }
    }

    if (Math.abs(pos - m) <= a[n - 1]) return 'NO';

    return 'YES';
};

function main() {
    let T = +readline();
    for (let t = 1; t <= T; t++){
        let [n, m] = ra();
        let a = ra();

        console.log(`${calc(n, m, a)}`);
    }
}

var t = readline();

for (var i = 0; i < t; i++) {
  var a = readline().split(' ').map(Number);
  var n = a[0], m = a[1];
  var l = readline().split(' ').map(Number);
  var res = l.reduce((prev, curr) => {
    return prev + curr;
  });

  var s = n + res - Math.min(...l) + Math.max(...l);
  if (s <= m) print('YES');
  else print('NO');
}

'use strict';

var fs = require('fs');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(n, m, a) {
  if (n > m) {
    console.log('NO');
    return false;
  }
  a.sort((a, b) => a - b);
  let j = 0;
  for (let i = 0; i < n - 1; i++) {
    var _a;
    j += Math.max(a[i], (_a = a[i + 1]) !== null && _a !== void 0 ? _a : 0) + 1;
  }
  j += Math.max(a[0], a[n - 1]);
  if (j < m) {
    console.log('YES');
    return true;
  } else {
    console.log('NO');
    return false;
  }
}

function main(inputs) {
  const t = Number(inputs[0]);
  for (let i = 0; i < t; i++) {
    const [n, m] = inputs[i * 2 + 1].trim().split(' ').map(Number);
    const a = inputs[i * 2 + 2].trim().split(' ').map(Number);
    solve(n, m, a);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
main(inputs);

'use strict';

const { checkPrime } = require('crypto');
const { Z_FIXED } = require('zlib');

 /*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++];
}
const l = process.env.DEBUG ? console.log : ()=>{};

module.exports = E;

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

const calc = (n, m, A)=>{
  A.sort((a, b)=>b-a);
  let frames = [];
  let prevI = 0;
  for (let i=1; i<n; i+=2){
    frames.push(A[prevI])
    prevI = i;
  }
  let l1 = prevI;
  prevI = 0;
  for (let i=2; i<n; i+=2){
    frames.push(A[prevI])
    prevI = i;
  }
  let l2 = prevI;
  frames.push(A[Math.min(l1, l2)])
  let sum = 0;
  for (let i=0; i<frames.length; i++){
    sum += frames[i]+1
  }
  l({n, m, A})
  l({frames, sum, l1, l2})
  return sum<=m ? 'YES' : 'NO'
};

function main() {
    let T = +readline()
    while (T--){
      let [n, m] = ra();
      let A = ra();
      l('ans')
      print(calc(n, m, A));
    }
}

E.calc = calc;

process.stdin.resume();
process.stdin.setEncoding("utf8");

let s = "";
process.stdin.on("data", (data) => {
  s += data;
});

process.stdin.on("end", () => {
  s = s.split("\n").map((z) => z.trim());

  main();
});

function main() {
  let t = Number(s[0]);

  let i = 1;
  while (t--) {
    const [n, m] = s[i].split(" ").map(Number);
    i++;
    const a = s[i].split(" ").map(Number);
    i++;

    solve(n, m, a);
  }
}

function solve(n, m, a) {
  if (n > m) {
    console.log("NO");
    return;
  }

  a.sort((q, w) => w - q);

  let count = a.length;
  const vacantCount = a.reduce((acc, val) => acc + val, 0);

  if (count + vacantCount + a[0] - a[a.length - 1] > m) {
    console.log("NO");
  } else {
    console.log("YES");
  }
}

'use strict';

var fs = require('fs');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(n, a) {
  let res = Infinity;
  for (let i = 0; i < n; i++) {
    const tmp = new Array(n).fill(0),
          queue = [[i + 1, 1], [i - 1, -1]];
    let count = 0;
    for (let [j, dj] of queue) {
      if (j < 0 || j >= n) continue;
      let num = Math.floor(tmp[j - dj] / (a[j] * dj)) + 1;
      tmp[j] = num * a[j] * dj;
      count += num;
      queue.push([j + dj, dj]);
    }
    res = Math.min(res, count);
  }
  console.log(res);
}

function main(inputs) {
  const n = Number(inputs[0].trim());
  const a = inputs[1].trim().split(' ').map(Number);
  solve(n, a);
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
main(inputs);

'use strict';

var fs = require('fs');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(n, m, a) {
  if (n > m) {
    console.log('NO');
    return false;
  }

  let j = 0;

  for (let i = 0; i < n - 1; i++) {
    var _a;

    j += Math.max(a[i], (_a = a[i + 1]) !== null && _a !== void 0 ? _a : 0) + 1;
  }

  j += Math.max(a[0], a[n - 1]);

  if (j < m) {
    console.log('YES');
    return true;
  } else {
    console.log('NO');
    return false;
  }
}

function main(inputs) {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, m] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const a = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    solve(n, m, a);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
main(inputs);

'use strict';

var fs = require('fs');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(n, m, a) {
  let j = 0;

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

    // if (j > 0 && j - pre - 1 < a[i]) j = pre + a[i] + 1
    if (j >= m - a[0]) {
      console.log('NO');
      return;
    }

    j += Math.max(a[i], (_a = a[i + 1]) !== null && _a !== void 0 ? _a : 0) + 1;

    if (j > m) {
      console.log('NO');
      return;
    }
  }

  console.log('YES');
}

function main(inputs) {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, m] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const a = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    solve(n, m, a);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
main(inputs);

'use strict';

var fs = require('fs');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(n, m, a) {
  let j = 0,
      pre = 0;

  for (let i = 0; i < n; i++) {
    if (j > 0 && j - pre - 1 < a[i]) j = pre + a[i] + 1;

    if (j >= m - a[0]) {
      console.log('NO');
      return;
    }
    [j, pre] = [j + a[i] + 1, j];

    if (j > m) {
      console.log('NO');
      return;
    }
  }

  console.log('YES');
}

function main(inputs) {
  const _ = Number(inputs[0]);

  for (let __ = 0; __ < _; __++) {
    const [n, m] = inputs[__ * 2 + 1].trim().split(' ').map(Number);
    const a = inputs[__ * 2 + 2].trim().split(' ').map(Number);
    solve(n, m, a);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
main(inputs);

'use strict';

const { checkPrime } = require('crypto');
const { Z_FIXED } = require('zlib');

 /*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++];
}
const l = process.env.DEBUG ? console.log : ()=>{};

module.exports = E;

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

const calc = (n, m, A)=>{
  A.sort((a, b)=>b-a);
  let arr = [0];
  let set = new Set();
  let num = 0;
  let prev = A[0]
  let l1, l2
  for (let i=1; i<n; i+=2){
    num += prev+1
    arr.push(num)
    prev = A[i]
  }
  l1 = num+prev;
  num = 0;
  prev = A[0]
  for (let i=2; i<n; i+=2){
    num += prev+1
    arr.push(-num)
    prev = A[i]
  }
  l2 = -(num+prev);
  l({n, m, A})
  l({arr, l1, l2})
  return l1-l2<=m ? 'YES' : 'NO'
};

function main() {
    let T = +readline()
    while (T--){
      let [n, m] = ra();
      let A = ra();
      l('ans')
      print(calc(n, m, A));
    }
}

E.calc = calc;


var t = +readline();

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

      var nums = [];
    var arr = readline()
    var arr = readline().split(' ').map((t) => +t)

    print(Challenging(arr));

}
function Challenging (jrray){

    var r = jrray.length;

    var f = 1;
    for(var i = 0; i<r-1 && f==1; i++){
        if (jrray[i] < jrray[i+1]){
            f = 0;
            while (jrray[i+1] >= jrray[i] && i < r-1){
                i++;
            }
            if(i == r-1){
                return 'YES';
            }else {
                return 'NO';
            }
        }

    }
    if (f == 1){
        return 'YES';
    }

}

let buf='';

process.stdin.on('readable', function(){
    let chunk=process.stdin.read();
    if(chunk) buf+=chunk.toString();
})

process.stdin.on('end', function(){
    const {EOL}=require('os');
    let line=buf.split(EOL);
    let t=parseInt(line[0]);
    for(let _=1;_<=t;_++)
    {
        let n=parseInt(line[2*_-1]);
        let a=line[2*_].split(' ').map(x=>{return parseInt(x)});
        let flag=false;
        a.unshift(1e9+10);
        a.push(1e9+10);
        // console.log(a);
        let cnt=0;
        for(let i=1;i<=n;i++)
        {
            let j=i;
            // if(a[i]===a[j])
            // {
                while(a[j]===a[i]&&j<=n) j++;
                j--;
                if(a[i]<a[j+1]&&a[i]<a[i-1])
                {
                    // console.log('i=',i);
                    // flag=true;
                    cnt++;
                }
                i=j;
            // }
        }
        if(cnt===1) console.log("YES");
        else console.log("NO");
    }
})

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = nextLong();
		}else if(code == 'double'){
			ret[i] = nextDouble();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');} function nextDoubleArray(size){return nextArray(size, 'double');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());} function nextDouble(){return parseFloat(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
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';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//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 t = nextInt();
	var alpha = "abcdefghijklmnopqrstuvwxyz";
	while(hasNext()){
		var N = nextInt();
		var list = nextIntArray(N);
		var newlist = [list[0]];
		for(var i = 1; i < N; i++){
			if(newlist[newlist.length - 1] != list[i]){
				newlist.push(list[i]);
			}
		}
		var c = 0;
		for(var i = 1; i < newlist.length - 1; i++){
			if(newlist[i - 1] > newlist[i] && newlist[i] < newlist[i + 1]){
				c++;
			}
		}
		if(newlist.length <= 2){
			c++;
		}else{
			if(newlist[0] < newlist[1]){
				c++;
			}
			if(newlist[newlist.length - 2] > newlist[newlist.length - 1]){
				c++;
			}
		}

		if(c == 1){
			myout("YES");
		}else{
			myout("NO");
		}
	}
}

const fs = require("fs");
const input = fs.readFileSync(0, 'utf8').trim().split('\r\n');
let currentline = 0;
function readline(){
      return input[currentline++];
}
function alph() {
  var f = 'abcdefghijklmnopqrstuvwxyz';
  return f;
}
function Alph() {
  var f = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  return f;
}
function max(x,y) {
  return x >=y ? x : y;
}
function min(x,y) {
  return x <=y ? x : y;
}
function abs(x) {
  return x < 0 ? x*(-1) : x;
}
var T = readline();
var inf = 1000000000000;
for(var tc=1;tc<=T;tc++) {
	var n = readline()-0;
	var a = readline().split(" ").map(w => parseInt(w));
	var ok = 0;
	a[-1] = inf;
	a[n] = inf;
	for(var i=0;i<n;i++) {
		if(a[i] < a[i-1]) {
			var j = i;
			while(j<n && a[i]===a[j]) j++;
			j--;
		    // console.log(i,j)
			if(a[j] < a[j+1]) {
				// console.log(j);
				ok++;
			}
			i = j;
		}
	}
	console.log(ok==1 ? "YES" : "NO")
}

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 n = +lines[l++]
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, arr) {
    let p, l, r, find = 0
    for (let i = 0; i < arr.length; i++) {
        if (arr[i] === p) {
            r = i
        } else {
            l = r = i
        }
        //
        const a = l === 0 || arr[l - 1] > arr[l]
        const b = r === n - 1 || arr[r] < arr[r + 1]
        if (a && b) {
            if (find) {
                return 'NO'
            } else {
                find = 1
            }
        }
        //
        p = arr[i]
    }
    return find ? 'YES' : 'NO'
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

process.stdin.on('end', function() {
    inputString = inputString.split('\n');

    main();
});

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

function gcd(a,b )
{
    if (!b)
        return a

    return gcd( b , a%b )
}

function main() {

    let t = parseInt(readLine());

    //let mod = 10**9+7
    loopwhile:
    while(t--)
    {
        let n = parseInt(readLine());

        let arr = readLine().trim().split(" ").map(x=>parseInt(x));

        let diff_arr =[]
        let upwards=false
        for(let i=0;i<n-1;++i){

            let cur=(arr[i]-arr[i+1])
            diff_arr+=cur
            if(cur<0)
            {
                upwards=true
            }
            //console.log("i " + i)
            //console.log("upwards " + upwards)
            if(upwards)
            {
                if(cur>0)
                {
                    console.log("no")
                    continue loopwhile
                }
            }

        }
        console.log("yes")
    }
}


var str = readline()
var winFirst = false;

for(var i=1;i<str.length;i++) {
    if(str[i] == str[i-1]) {
        winFirst = !winFirst;
        str = str.slice(0,i-1) + str.slice(i+1)
        i -= 2;
    }
}
print(winFirst ? 'Yes' : 'No')

//var input = readline()
var str = readline()

var ans = [];
    var cnt = 0;
    for (var j=0; j<str.length; j++) {
          if (ans[ans.length-1] == str[j]) {
            //while(s[j] == s[j+1] && s.length > 0) {
                ans.pop();
                //print('pop = '+ ans.join(''));
			    cnt ++;
            }
		    else {
                ans.push(str[j]);
                //print('push = '+ ans.join(''))
            }
}
if(cnt == 0) print('NO')
else {
      print(cnt %2 == 1 ? 'YES' : 'NO')
  }

//

const readline = require('readline')

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

rl.on('line', line => {
  const output = solution(line)
  console.log(output)
})

rl.on('close', () => {
  // console.log(input)
})

function solution(line) {
  let input = line.split('')
  let j = 0
  for (let i = 0;i < input.length;i++) {
    if (i < input.length - 1) {
      if (input[i] === input[i+1]) {
        j++
        input.splice(i, 2)
        i = i - 2
        continue
      }
    }
  }
  if (j % 2 === 0) {
    return 'NO'
  }
  return 'YES'
}

var str = '';
var readliner = require('readline');
var rl = readliner.createInterface(process.stdin, process.stdout, null);
rl.on('line', function (cmd) {
                  //console.log('You just typed: '+cmd);
                  str = cmd;
              }).on('close', main);

function main() {
    //console.log('goodbye!');

/*    var mn = 1000000000;
    for (var code=0; code<(1<<9); code++) {
	var cnt_ones = 0;
	for (var j=0; j<9; j++) cnt_ones += (code>>j)&1;
        var x = N;

    }*/

    var ans = [];
    var Q = 0;
    //console.log(str);
    for (var j=0; j<str.length; j++)
        if (ans.length > 0 && ans[ans.length-1] == str[j]) {
			ans.pop();
			Q++;
        }
		else
			ans.push(str[j]);

    //console.log(ans);
    //console.log(Q);

    if (Q % 2 === 1)
    	console.log("Yes");
    else
    	console.log("No");

    //var x = 1.2345678;
    //console.log('x = ',Number(x).toFixed(5));

    process.exit(0);
};

//var lines = data.split(/\r?\n/);

function main(str){

    var cnt = 0;
    var stack = [];
    stack.push(str[0]);

    for(var i = 1 ; i < str.length ; i++){
      if(stack.length !== 0 && str[i] === stack[stack.length-1]){
        cnt++;
        stack.pop();
      }
      else{
        stack.push(str[i]);
      }
    }

    cnt % 2 === 0 ? print("NO") : print("YES");
}

var str = readline();

main(str);

var str = readline()
var winFirst = false;

for(var i=1;i<str.length;i++) {
    if(str[i] == str[i-1]) {
        winFirst = !winFirst;
        str = str.slice(0,i-1) + str.slice(i+1)
        i = i - 2;
    }
}
print(winFirst ? 'Yes' : 'No')

var line = readline().split("");
function check() {
    var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

    for (var i = start; i < line.length - 1; i++) {
        if (line[i] === line[i + 1]) {
            return i;
        }
    }
    return false;
}

var index = check();
var count = 0;
while (index !== false) {
    line.splice(index, 2);
    count++;
    if (index > 0) index--;
    index = check(index);
}

write(count % 2 === 1 ? "Yes" : "No");

var line = readline().split('');
var count = 0;
while (1) {
  var length = line.length;
  var c = count;
  for (var i = 0; i < length - 1; i++) {
    if (line[i] === line[i + 1]) {
      line.splice(i, 2)
      count++;
      i-=2;
      length -= 2;
    }
  }
  if (c === count) {
    break;
  }
}

write(count % 2 === 1 ? 'Yes' : 'No')

const readline = require('readline')

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

rl.on('line', line => {
  const output = solution(line)
  console.log(output)
})

rl.on('close', () => {
  // console.log(input)
})

function solution(line) {
  let input = line.split('')
  let length = input.length
  for (let i = 0;i < input.length;i++) {
    if (i < input.length - 1) {
      if (input[input.indexOf(input[i])] === input[input.indexOf(input[i + 1])]) {
        input.splice(i, 2)
        i = i - 2
        continue
      }
    }
  }
  console.log(input)
  if (input.length === length || !input.length) {
    return 'NO'
  }
  return 'YEs'
}

var str = readline()
var winFirst = false;

for(var i=1;i<str.length;i++) {
    if(str[i] == str[i-1]) {
        winFirst = !winFirst;
        str = str.slice(0,i-1) + str.slice(i+1)
        --i;
    }
}
print(winFirst ? 'Yes' : 'No')

function ansa(str){

    var t = 0;
    var strans = str;
    var i = 0;
    while(i !== strans.length){
      if(strans[i] === strans[i+1]){
        strans = strans.slice(0,i) + strans.slice(i+2);
      //  console.log(strans);
        t++;
        i = 0;
      }
      else{
        i++;
      }
    }
    t%2 === 0 ? print("No") : print("Yes");
}

var line = readline().split(' ');
// for(var i = 0 ; i < line.length ; i++) line[i] = parseInt(line[i]);
// var line2 = readline().split(' ');
// for(var i = 0 ; i < line2.length ; i++) line2[i] = parseInt(line2[i]);

ansa(line);

function readline() {
  return 'abba'
}

var line = readline().split('');
var count = 0;
while (1) {
  var found = false;
  for (var i = 0; i < line.length - 1; i++) {
    if (line[i] === line[i + 1]) {
      line.splice(i, 2)
      count++;
      found = true;
      break
    }
  }
  if (!found) break;
}

write(count % 2 === 1 ? 'Yes' : 'No')

//var input = readline()
var str = readline()

var cnt = 0
var s = str.split('')
var first = 1

var L = s.length
for(var i=0; i<first; i++) {
    for(var j=0; j<L; j++) {
        if(s[j] == s[j+1]) {
            var ind = s.indexOf(s[j])
            s.splice(ind, 2)
            //first ++
            cnt ++
            //print(s.join(''))
        }
    }
}
if(cnt == 0) print('NO')
else {
    print(cnt % 2 == 1 ? 'YES' : 'NO');
}

//

//var input = readline()
var str = readline()

var cnt = 0
var s = str.split('')
var first = 1

for(var i=0; i<first; i++) {
    for(var j=0; j<s.length; j++) {
        if(s[j] == s[j+1]) {
            var ind = s.indexOf(s[j])
            s.splice(ind, 2)
            first ++
            cnt ++
        }
    }
}
if(cnt == 0) print('NO')
else {
    print(cnt % 2 == 1 ? 'YES' : 'NO');
}

//

//var input = readline()
var str = readline()

var cnt = 0
var s = str.split('')
var first = 1

//for(var i=0; i<first; i++) {
    for(var j=0; j<s.length; j++) {
        while(s[j] ==  s[j+1]){
            //var ind = s.indexOf(s[j])
            s.splice(j, 2)
            //first ++
            cnt ++
            print(s.join(''))
            j--
        }
    }
//}
if(cnt == 0) print('NO')
else {
    print(cnt % 2 == 1 ? 'YES' : 'NO');
}

//


class Utility {
    static stringToInts(str) {
       let digits = [];
       for (let i = 0; i < str.length; i++)
          digits.push(parseInt(str.charAt(i)));
       return digits;
    }
    static parseToInts(str, separator) {
       let digits = [];
       Utility.forEach(str.split(separator), s => { digits.push(parseInt(s)); });
       return digits;
    }
    static forEach(arr, fnc) {
       for (let i = 0; i < arr.length; i++)
          fnc(arr[i]);
    }
    static max(p1, p2) {
       return p1 > p2 ? p1 : p2;
    }
    static reverse(arr) {
       let rarr = [];
       for (let i = arr.length - 1; i >= 0; i--)
          rarr.push(arr[i]);
       return rarr;
    }
    static range(n) {
       let range = [];
       for (let i = 1; i <= n; i++)
          range.push(i);
       return range;
    }
    static equals(arr1, arr2) {
       return JSON.stringify(arr1) == JSON.stringify(arr2);
    }
    static processStdin(afterCallback) {
       process.stdin.resume();
       process.stdin.setEncoding('utf-8');

       let inputString = '';

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

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

          afterCallback(inputString);
       });
    }
 }

function solve(input) {
    let d = Utility.parseToInts(input[0], ' ');
    let n = d[0], l = d[1];
    let A = Utility.parseToInts(input[1], ' ');
    A = A.sort((a, b) => a - b);

    let maxDist = 0;
    if (n > 0) {
        if (A[0] != 0) maxDist = A[0];
        if (A[A.length - 1] != l) {
            let md = l - A[A.length - 1];
            if (md > maxDist) maxDist = md;
        }

        for (let i = 1; i < A.length; i++) {
            let md = (A[i] - A[i - 1]) / 2;
            if (md > maxDist) maxDist = md;
        }
    }
    console.log(maxDist.toFixed(10));
}

Utility.processStdin(solve);

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

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

readLine.on('close', () => {
  let [n, l]  = input[0].split(' ').map(x => parseInt(x));
  const nums = input[1].split(' ').map(x => parseInt(x));

  nums.sort((a, b) => a - b);
  let max = (nums.length === 1) ? Math.max(nums[0], l-nums[0]) : 0;

  for (let i = 1; i < nums.length; i += 1) {
    if (Math.abs(nums[i] - nums[i-1]) > max) max = Math.abs(nums[i] - nums[i-1])
  }

  max /= 2;
  if (nums[0] >= max || l-nums[nums.length-1] >= max) {
    console.log(Math.max(nums[0], l-nums[nums.length-1]).toPrecision(9))
  } else console.log(max.toPrecision(9));
});

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

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

readline.on('close', () => {
    const [n, l] = input[0].split(' ').map(Number);
    const arr = input[1].split(' ').map(Number);
    arr.sort((a, b) => a - b);
    let dist = arr[0] - 0;
    if ((l - arr[arr.length - 1]) > dist) dist = l - arr[arr.length - 1];
    for (let i = 1; i < arr.length; i++) {
        if (((arr[i] - arr[i - 1]) / 2) > dist) dist = (arr[i] - arr[i - 1]) / 2;
    }
    console.log(dist);
});

'use strict';

// const rlLib = require('readline');

// const rl = rlLib.createInterface({
//   input: process.stdin,
//   output: process.stdout
// });

// let inputs = [];
// let allCount = 2;
// let currentLine = 0;

// rl.on('line', (input) => {
// 	inputs.push(input);
// 	if (inputs.length === allCount) {
// 		main();

// 		rl.close();
// 	}
// });

// function readline() {
// 	return inputs[currentLine++];
// }
// function print() {
// 	console.log.apply(this, arguments);
// }

// function main() {
	let rl = readline().split(' ').map(function(e) {return parseInt(e);});
	let f = readline().split(' ').map(function(e) {return parseInt(e, 10);});

	f = f.sort(function(a, b) {return a - b;});

	let res = f[0] * 2;

	if (f[f.length - 1] < rl[1]) {
		let r = (rl[1] - f[f.length - 1])*2;
		res = res > r ? res : r;
	}

	f.forEach(function(e, i) {
		if (i+1 < f.length && (f[i+1] - f[i]) > res) {
			res = f[i+1] - f[i];
		}
	});

	print(res / 2);
// }

let solution = function (n, l, arr) {
  arr.sort((x, y) => (x - y))
  // let check = function(i) {
  //   let smallest = 0
  //   for(let x of arr) {
  //     let left = x - i
  //     let right = x + i
  //     if(left > smallest+1) return false
  //     smallest = right
  //   }
  //   return right >= l
  // }

  // let left = 1
  // let right = l
  // while(left > right) {
  //   let mid = Math.floor((left + right)/2)
  //   if(check(mid)) {
  //     right = mid-1
  //   } else {
  //     left = mid+1
  //   }
  // }
  // while(check(left)) {
  //   left--
  // }
  // return left+1
  let max = 0
  let first = arr[0]
  let last = l - arr[arr.length-1]
  for(let i = 1; i<arr.length; i++) {
    let right = arr[i]
    let left = arr[i-1]
    let x = (right - left)/2
    max = Math.max(max, x)
  }
  return Math.max(max, first, last)
}

// console.log(solution(7, 15, [15,5,3,7,9,14,0]))

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

let lineCount = 0
var n, l, arr

rl.on('line', (line) => {
  lineCount++
  if(lineCount === 1) {
    [n, l] = line.split(' ').map(x => parseInt(x))
  }
  if(lineCount === 2) {
    arr = line.split(' ').map(x => parseInt(x))
    // console.log(n, l, arr)
    result = solution(n, l, arr)
    console.log(result)
  }
})

"use strict";

var input = readline().split(' ').map(value => +value);
var n = input[0];
var l = 2 * input[1];
var a = readline().split(' ').map(value => 2 * value).sort((a, b) => a - b);

var f = function (x) {
    var right = 0;

    for (let i = 0; i < n; ++i) {
        if (right < a[i] - x) {
            return false;
        }

        right = a[i] + x;
    }

    return right >= l;
};

var left = 0;
var right = l;

while (right - left > 1) {
    var m = Math.floor((left + right) / 2);

    if (f(m)) {
        right = m;
    } else {
        left = m;
    }
}

write(right / 2);

X=readline().split(' ').map(Number)
n=X[0],l=X[1]
A=readline().split(' ').map(Number)
A=A.sort((x,y)=>x-y).reduce((a,c)=>a.length?(a[a.length-1]!=c?a.concat(c):a):[c],[])

A=A.map((x,i) =>
    Math.max(i==0 ? x : (A[i-1]-x)/2, (i==A.length-1) ? l-x : (A[i+1]-x)/2))

print(Math.max.apply(null, A))

function main() {
  var counters = readline().trim().split(' ').map(string => parseInt(string, 10));
  var lanternsCount = counters[0];
  var streetLength = counters[1];
  var lanternsLocation = readline().trim().split(' ').map(string => parseInt(string));

  lanternsLocation = lanternsLocation.sort((a, b) => a - b);

  var min_radius = 0.0000000000;
  for (var index = 0; index < lanternsLocation.length - 1; index++) {
    var curr_radius = (lanternsLocation[index + 1] - lanternsLocation[index]) / 2.0000000000;
    min_radius = Math.max(min_radius, curr_radius);
  }

  if (!lanternsLocation.includes(0)) {
    min_radius = Math.max(min_radius, lanternsLocation[0]);
  }

  if (!lanternsLocation.includes(streetLength)) {
    min_radius = Math.max(min_radius, streetLength - lanternsLocation[lanternsLocation.length - 1]);
  }

  print(min_radius);
}

main();

let fs = require('fs');

let txt = fs.readFileSync(0, "utf-8").split(/[\n\r]/).filter(data => data.length > 0);

for (let i = 0; i < txt.length; i += 2) {
    let info = txt[i].split(" ");
    doit(info[1] * 1, txt[i + 1].split(" ").filter(data => data.length > 0).map(data => data * 1).sort((a, b) => a - b));
}

function doit(n, tab) {
    let changes = tab[0];
    let g = (n - tab[tab.length - 1]);
    if (g > changes) changes = g;
    for (let i = 1; i < tab.length; i++) {
        let r = (tab[i] - tab[i - 1]) / 2;
        if (changes < r) changes = r;
    }
    console.log(changes);

}

// var _i = 0;
//
// function readline() {
//     _i ++;
//
//     switch (_i) {
//         case 1: return '2 1000000000';
//         case 2: return '0 1000000000';
//     }
// }
//
// function write(value) {
//     console.log(value);
// }

var list = readline().split(' ');

var n = parseInt(list[0]);
var l = parseInt(list[1]);

var a = readline().split(' ').map(function(currentValue) {
    return parseInt(currentValue);
});

a.sort(function(x, y) {
    return x - y;
});

var ans = Math.max(a[0], l - a[a.length - 1]);

for (var i = 1; i < a.length; i ++) {
    ans = Math.max(ans, (a[i] - a[i-1]) / 2);
}

write(ans);

var tokens = readline().split(" ");
var n = +tokens[0];
var l = +tokens[1];
var array = readline().split(" ").map(Number).sort(function(x,y){return x-y});
var max = -1;
for(var i = 1; i < n; i++){
    var value = array[i] - array[i-1];
    max = max > value ? max : value;
}
var res = Math.max(max/2,array[0] - 0, l - array[n-1] );
write(res);

var input = readline().split(' ').map(x => parseInt(x));
var n = input[0], l = input[1];
var sorted = readline().split(' ').map(x => parseInt(x)).sort((a,b) => a-b);
var difference = -Infinity;
for (var i = 1; i < sorted.length; i++) difference = Math.max(difference, sorted[i] - sorted[i-1]);
difference /= 2;
if (sorted[0] !== 0) difference = Math.max(sorted[0], difference);
if (sorted[n-1] !== l) difference = Math.max(difference, l - sorted[n-1]);
print(difference);

var input = readline().split(" "), n = +input[0], l = +input[1],
a = readline().split(" ").map(Number).sort(function(x,y){return x-y});
var max = -1, x;

for(i = 1; i < n; i++){
	x = a[i] - a[i-1];
	max = (x > max) ? x : max;
}

x = Math.max(max/2, Math.max((l - a[n-1]), (a[0] - 0)));

write(x.toFixed(10));

var inp = readline().split(" ").map(function(x){return parseInt(x);});
var n = inp[0];
var l = inp[1];

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

a.sort(function(e,x){return e - x;});
if (a[0] != 0){
	a.unshift(-a[0]);
	n++;
}
if (a[n-1] != l){
	a.push(l + (l-a[n-1]));
	n++;
}
var max = 0;
var dif = max;
for(var i=1; i < n; i++){
	dif =  a[i] - a[i-1];
	if (dif > max) max = dif;
}

print(max/2);

if (undefined == readline) {
	readline = function() {

	}
}

var ints = function() {
	return readline().split(' ').map(function(w) {
		return parseInt(w)
	})
}

var minus = function(a, b) {
    return a - b
}

var numbers = ints()
	n = numbers[0],
	l = numbers[1]
numbers = ints()
numbers.sort(minus)

var k = numbers.length - 1,
	distance = Math.max(2 * numbers[0], 2 * (l - numbers[numbers.length - 1]))

while (k > 0) {
	distance = Math.max(distance, numbers[k] - numbers[k - 1])
	k --
}

print((distance / 2).toFixed(9))

var n, l, max = 0.0;
var input = readline();
n = Number(input.split(" ")[0]);
l = Number(input.split(" ")[1]);

var lanterns = new Array(n);
input = readline();

for (var i = 0; i < lanterns.length; i++) {
  lanterns[i] = Number(input.split(" ")[i]);
}

for (var i = 0; i < lanterns.length - 1; i++) {
  for (var j = i + 1; j < lanterns.length; j++) {
    if (lanterns[i] > lanterns[j]) {
      var tmp = lanterns[i];
      lanterns[i] = lanterns[j];
      lanterns[j] = tmp;
    }
  }
} // sorting

for (var i = 0; i < lanterns.length - 1; i++) {
   var difference = lanterns[i + 1] - lanterns[i];
   if (difference > max) {
     max = difference;
   }
}
max /= 2;
var first = lanterns[0] - 0;
var last = l - lanterns[n - 1];

if (first > max) {
  max = first;
}
if (last > max) {
  max = last;
}

write(max);

var input = readline().trim().split(' ').map((x)=>parseInt(x));
var a = readline().trim().split(' ').map((x)=>parseInt(x));

if(input[0]==1)
    print(Math.max(a[0],input[1]-a[0]));
else{
    a.sort((a,b)=>a-b);

    var b =[];
    for (var i = 0; i < a.length-1; i++) {
    	b.push(a[i+1]-a[i]);
    }

    b.sort((a,b)=>b-a)
    print(Math.max((b[0]*1.0)/2,a[0],input[1]-a[a.length-1]));
}

var s = readline().split(" ");
var n = Number(s[0]), l = Number(s[1]);
s = readline().split(" ").map(Number).sort((a, b) => a-b);

var maxDif = Math.max(s[0] * 2, (l - s[n-1]) * 2);
for(var i = 1; i < n; i++) {
    maxDif = Math.max(maxDif, s[i] - s[i-1]);
}

print(maxDif / 2);

var s = readline().split(' ');
var n = Number(s[0]), l = Number(s[1]);
s = readline().split(' ').map(Number).sort((a, b) => a - b)
var maxDif = Math.max(s[0] * 2, (l - s[n - 1]) * 2);
for (var i = 1; i < n; i++) {
    maxDif = Math.max(maxDif, s[i] - s[i - 1]);
}
print(maxDif / 2);

'use strict'

String.prototype.getNumArray = function () {
  return String(this).split(' ').map(function (value) {
    return parseInt(value);
  });
}

let _arr = readline().getNumArray(),
    n = _arr[0],
    l = _arr[1],
    array = readline().getNumArray(),
    maxDistance = 0;

array.sort(function(a, b) {
  return a - b;
});

for(let i = 1; i < array.length; i++) {
  if(array[i] - array[i - 1] > maxDistance) {
    maxDistance = array[i] - array[i - 1];
  }
}

if (array[0] > maxDistance / 2 || l - array[array.length - 1] > maxDistance / 2) {
  if(array[0] > l - array[array.length - 1]) {
    maxDistance = array[0];
  } else {
    maxDistance = l - array[array.length - 1];
  }
} else {
  maxDistance = maxDistance / 2;
}
write(maxDistance);

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

const input = [];

function splitAndParseInt(line) {
  return line.split(" ").map((x) => parseInt(x));
}

readLine.on("line", (line) => input.push(line));
readLine.on("close", () => {
  const [n, l] = splitAndParseInt(input[0]);
  const nums = splitAndParseInt(input[1]);

  nums.sort((a, b) => a - b);
  let maxD = 0;

  if (nums.length > 1)
    for (let i = 1; i < nums.length; i += 1) {
      maxD = nums[i] - nums[i - 1] > maxD ? nums[i] - nums[i - 1] : maxD;
    }

  if (nums[0] * 2 > maxD) maxD = nums[0] * 2;
  if ((l - nums[nums.length - 1]) * 2 > maxD)
    maxD = (l - nums[nums.length - 1]) * 2;

  console.log((maxD / 2).toFixed(9));
});

var f = readline().split(" ");
var str = readline().split(" ").sort((x,y)=>x-y);
var res = Math.max(+str[0] * 2, (+f[1] - str[+f[0]-1]) * 2);
	for (var i=0; i<+f[0]; i++){
			if (Number(str[i+1])-Number(str[i])>res)
				res = +str[i+1]-Number(str[i]);

	}
	print(res/2);

var main = function(nPositions, l)
{
	var max = 0;
	var increase = function(a, b)
	{
		return +a - +b;
	}
	var toAnArray = function(str)
	{
		str = str.split(' ');
		return str;
	}
	nPositions = toAnArray(nPositions);
	nPositions.sort(increase);
	for (var i = 1; i <= nPositions.length - 1; i++)
	{
		if (+nPositions[i] - +nPositions[i - 1] > max) max = +nPositions[i] - +nPositions[i - 1];
	}
    if (((+nPositions[0] > max / 2) && (l - +nPositions[nPositions.length - 1] > max / 2)) && (+nPositions[0] > l - +nPositions[nPositions.length - 1] ) )return +nPositions[0];
		else if (((+nPositions[0] > max / 2) && (l - +nPositions[nPositions.length - 1] > max / 2)) && (+nPositions[0] < l - +nPositions[nPositions.length - 1] ) )return l - +nPositions[nPositions.length - 1];
		else if (+nPositions[0] > max / 2) return +nPositions[0];
		else if (l - +nPositions[nPositions.length - 1] > max / 2) return l - +nPositions[nPositions.length - 1];
		else return max / 2;

}

{
	var lAndN = readline(),
	nPositions = readline();
	lAndN = lAndN.split(' ');
	print(main(nPositions, +lAndN[1]));
}

var inp = readline().split(' ');
var a = readline().split(' ');

for(var i=0; i<inp.length; i++) {
    inp[i] = parseInt(inp[i], 10);
}
var n = inp[0], m = inp[1];

for(var i=0; i<a.length; i++) {
    a[i] = parseInt(a[i], 10);
}

a.sort((a,b) => a-b);

var max_d = -Infinity;

if(a[0] !== 0) max_d = a[0];
if(a[n-1] !== m && m - a[n-1] > max_d) max_d = m - a[n-1];

for(var i=0; i<a.length; i++) {
    if((a[i] - a[i-1])/2 > max_d) max_d = (a[i] - a[i-1])/2;
}

print(max_d);

(function main() {
    var line = readline().split(" "),
        n = line[0],
        l = line[1],
        aStrings = readline().split(" "),
        a = [],
        d,
        i;

    for (i in aStrings) {
        a[i] = +aStrings[i];
    }

    a.sort(function(a, b) {
        return a - b;
    });

    d = Math.max(a[0], l - a[a.length - 1]);

    for (i = 1; i < a.length; i++) {
        d = Math.max(d, (a[i] - a[i-1]) / 2);
    }

    print(d.toFixed(10));
})();

var n = readline().split(' ');

var l = n[1];
n = n[0];

var a = readline().split(' ');
for (var i = 0; i < n; i++) {
    a[i] = parseInt(a[i])
}
a.sort(function (a, b) { return a - b });
var ans = Math.max(a[0], l - a[n - 1]);

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

write(ans)
// console.log(l)

var nums = readNums();

var n = nums[0];
var l = nums[1];

var lanterns = readNums();
lanterns.sort(function(a,b){return b-a});

var k = 0;

for (var i = 0; i<n ;i++) {
    var h = lanterns[i]-lanterns[i+1];
    if (h>k) {
        k = h;
    }
}

var r = k/2;

if (lanterns[n-1] > r) {
    r = lanterns[n-1];
}

if ((l-lanterns[0]) > r) {
    r = l-lanterns[0];
}

print(r);

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

var input = readline(), n = +input[0], l = +input[1],
a = readline().split(" ").map(Number).sort(function(x,y){return x-y});
var max = -1, x;

for(i = 1; i < n; i++){
	x = a[i] - a[i-1];
	max = (x > max) ? x : max;
}

max = Math.max(max/2, Math.max((l - a[n-1]), a[0]));

write(max.toFixed(10));

var inp = readline().split(" ").map(function(x){return parseInt(x);});
var n = inp[0];
var l = inp[1];

var a = readline().split(" ").map(function(x){return parseInt(x);});
a.sort(function(e,x){return e > x;});
if (a[0] != 0){
	a.unshift(-a[0]);
	n++;
}
if (a[n-1] != l){
	a.push(l + (l-a[n-1]));
	n++;
}
var max = 0;
var dif = max;
for(var i=1; i < n; i++){
	dif =  a[i] - a[i-1];
	if (dif > 0 && dif > max) max = dif;
}

print(max/2);

var ints = function() {
	return readline().split(' ').map(function(w) {
		return parseInt(w)
	})
}

var minus = function(a, b) {
    return a - b
}

var numbers = ints()
	n = numbers[0],
	l = numbers[1]
numbers = ints()
numbers.sort(minus)

var result = numbers.reduce(function(current, position) {
	current.max = Math.max(current.max, position - current.position)
	current.position = position
	return current
}, {
	max: 0,
	position: 0
})

print((result.max / 2).toFixed(9))

var input = readline().trim().split(' ').map((x)=>parseInt(x));
var a = readline().trim().split(' ').map((x)=>parseInt(x));

a.sort((a,b)=>a-b);

var b =[];
for (var i = 0; i < a.length-1; i++) {
	b.push(a[i+1]-a[i]);
}

b.sort((a,b)=>b-a)
print(Math.max((b[0]*1.0)/2,a[0],input[1]-a[a.length-1]));

var s = readline().split(' ');
var n = Number(s[0]), l = Number(s[1]);
s = readline().split(' ').map(el => parseInt(el)).sort((a, b) => a - b)
var maxDif = Math.max(s[0] * 2, (l - s[n - 1] * 2));
for (var i = 1; i < n; i++) {
    maxDif = Math.max(maxDif, s[i] - s[i - 1]);
}
print(maxDif / 2);

var s = readline().split(' ');
var n = Number(s[0]), l = Number(s[1]);
s = readline().split(' ').map(Number).sort((a, b) => a - b)
var maxDif = Math.max(s[0] * 2, (l - s[n - 1] * 2));
for (var i = 1; i < n; i++) {
    maxDif = Math.max(maxDif, s[i] - s[i - 1]);
}
print(maxDif / 2);

var s = readline().split(' ');
var n = Number(s[0]), l = Number(s[1]);
s = readline().split(' ').map(el => parseFloat(el)).sort((a, b) => a - b)
var maxDif = Math.max(s[0] * 2, (l - s[n - 1] * 2));
for (var i = 1; i < n; i++) {
    maxDif = Math.max(maxDif, s[i] - s[i - 1]);
}
print(maxDif / 2);

'use strict'

String.prototype.getNumArray = function () {
  return String(this).split(' ').map(function (value) {
    return parseInt(value);
  });
}

let _arr = readline().getNumArray(),
    n = _arr[0],
    l = _arr[1],
    array = readline().getNumArray(),
    maxDistance = 0;

array.sort(function(a, b) {
  return a - b;
});

for(let i = 1; i < array.length; i++) {
  if(array[i] - array[i - 1] > maxDistance) {
    maxDistance = array[i] - array[i - 1];
  }
}

if (array[0] > maxDistance / 2 || l - array[array.length - 1] > maxDistance / 2) {
  if(array[0] > maxDistance / 2) {
    maxDistance =array[0];
  } else {
    maxDistance = l - array[array.length - 1];
  }
} else {
  maxDistance = maxDistance / 2;
}
write(maxDistance);

'use strict'

String.prototype.getNumArray = function () {
  return String(this).split(' ').map(function (value) {
    return parseInt(value);
  });
}

let _arr = readline().getNumArray(),
    n = _arr[0],
    l = _arr[1],
    array = readline().getNumArray(),
    maxDistance = 0;

array.push(0);
array.push(l);

array.sort(function(a, b) {
  return a - b;
});

for(let i = 1; i < array.length; i++) {
  if(array[i] - array[i - 1] > maxDistance) {
    maxDistance = array[i] - array[i - 1];
  }
}

write(maxDistance / 2);

var f = readline().split(" ");
var str = readline().split(" ").sort((x,y)=>x-y);
var res = Math.min.apply(this, str);
	for (var i=0; i<+f[0]; i++){
			if (Number(str[i+1])-Number(str[i])>res)
				res = +str[i+1]-Number(str[i]);

	}
	print(Math.min.apply(this, str)!=0? Math.min.apply(this, str): res/2);

var f = readline().split(" ");
var str = readline().split(" ").sort((x,y)=>x-y);
var res = 0;
	for (var i=0; i<+f[0]; i++){
			if (Number(str[i+1])-Number(str[i])>res)
				res = +str[i+1]-Number(str[i]);

	}
	print(res/2>=Math.min.apply(this, str)? res/2:Math.min.apply(this, str));

var main = function(nPositions, l)
{
	var max = 0;
	var increase = function(a, b)
	{
		return +a - +b;
	}
	var toAnArray = function(str)
	{
		str = str.split(' ');
		return str;
	}
	nPositions = toAnArray(nPositions);
	nPositions.sort(increase);
	for (var i = 1; i <= nPositions.length - 1; i++)
	{
		if (+nPositions[i] - +nPositions[i - 1] > max) max = +nPositions[i] - +nPositions[i - 1];
	}
	if (+nPositions[0] > max / 2) return (+nPositions[0]).toFixed(10);
	else if (l - +nPositions[nPositions.length - 1] > max / 2) return (l - +nPositioins[nPositions.length - 1]).toFixed(10);
	else return (max / 2).toFixed(10);

}

{
	var lAndN = readline(),
	nPositions = readline();
	lAndN = lAndN.split(' ');
	print(main(nPositions, +lAndN[1]));
}

var main = function(nPositions, l)
{
	var max = 0;
	var increase = function(a, b)
	{
		return +a - +b;
	}
	var toAnArray = function(str)
	{
		str = str.split(' ');
		return str;
	}
	nPositions = toAnArray(nPositions);
	nPositions.sort(increase);
	for (var i = 1; i <= nPositions.length - 1; i++)
	{
		if (+nPositions[i] - +nPositions[i - 1] > max) max = +nPositions[i] - +nPositions[i - 1];
	}
	if (((+nPositions[0] > max / 2) && (l - +nPositions[nPositions.length - 1] > max / 2)) && (+nPositions[0] > l - +nPositions[nPositions.length - 1] ) )return +nPositions[0];
		else if (((+nPositions[0] > max / 2) && (l - +nPositions[nPositions.length - 1] > max / 2)) && (+nPositions[0] < l - +nPositions[nPositions.length - 1] ) )return l - +nPositions[nPositions.length - 1];
		else if (+nPositions[0] > max / 2) return +nPositions[0];
		else if (l - +nPositions[nPositions.length - 1] > max / 2) return l - +nPositions[nPositions.length - 1] > max / 2;
		else return max / 2;

}

{
	var lAndN = readline(),
	nPositions = readline();
	lAndN = lAndN.split(' ');
	print(main(nPositions, +lAndN[1]));
}

var inp = readline().split(' ');
var a = readline().split(' ');

for(var i=0; i<inp.length; i++) {
    inp[i] = parseInt(inp[i], 10);
}
var n = inp[0], m = inp[1];

for(var i=0; i<a.length; i++) {
    a[i] = parseInt(a[i], 10);
}

a.sort((a,b) => a-b);

var max_d = -Infinity;

for(var i=0; i<a.length; i++) {
    if(i === 0 && a[i-1] !== 0) max_d = a[i];
    else if((a[i] - a[i-1])/2 > max_d) max_d = (a[i] - a[i-1])/2;
}

print(max_d);

(function main() {
    var line = readline().split(" "),
        l = line[0],
        n = line[1],
        aStrings = readline().split(" "),
        a = [],
        d,
        i;

    for (i in aStrings) {
        a[i] = +aStrings[i];
    }

    a.sort(function(a, b) {
        return a - b;
    });

    d = Math.max(a[0], l - a[a.length - 1]);

    for (i = 1; i < a.length; i++) {
        d = Math.max(d, (a[i] - a[i-1]) / 2);
    }

    print(d.toFixed(10));
})();

'use strict';

// const rlLib = require('readline');

// const rl = rlLib.createInterface({
//   input: process.stdin,
//   output: process.stdout
// });

// let inputs = [];
// let allCount = 2;
// let currentLine = 0;

// rl.on('line', (input) => {
// 	inputs.push(input);
// 	if (inputs.length === allCount) {
// 		main();

// 		rl.close();
// 	}
// });

// function readline() {
// 	return inputs[currentLine++];
// }
// function print() {
// 	console.log.apply(this, arguments);
// }

// function main() {
	let rl = readline().split(' ').map(function(e) {return parseInt(e);});
	let f = readline().split(' ').map(function(e) {return parseInt(e, 10);});

	f = f.sort(function(a, b) {return a - b;});

	if (f[f.length - 1] !== rl[1]) {
		f.push(rl[1] * 2);
	}

	let res = f[0] * 2;

	f.forEach(function(e, i) {
		if (i+1 < f.length && (f[i+1] - f[i]) > res) {
			res = f[i+1] - f[i];
		}
	});

	print(res / 2);
// }

// var _i = 0;
//
// function readline() {
//     _i ++;
//
//     switch (_i) {
//         case 1: return '2 1000000000';
//         case 2: return '0 1000000000';
//     }
// }
//
// function write(value) {
//     console.log(value);
// }

function f(d) {
    if (d < a[0] || a[a.length-1] + d < l) {
        return false;
    }

    for (var i = 1; i < a.length; i ++) {
        if (a[i-1] + d < a[i] - d) {
            return false;
        }
    }

    return true;
}

var list = readline().split(' ');

var n = parseInt(list[0]);
var l = parseInt(list[1]);

var a = readline().split(' ').map(function(currentValue) {
    return parseInt(currentValue);
});

a.sort(function(x, y) {
    return x - y;
});

var x = 0;
var y = l;
var m;

var EPS = 10e-6;

while (Math.abs(x - y) > EPS) {
    m = (x + y) / 2;
    if (f(m)) {
        y = m;
    } else {
        x = m;
    }
}

write(m);

var tokens = readline().split(" ");
var n = +tokens[0];
var l = +tokens[1];
var array = readline().split(" ").map(Number).sort(function(x,y){return x-y});
var max = -1;
for(var i = 1; i < n; i++){
    var value = array[1] - array[0];
    max = max > value ? max : value;
}
var res = Math.max(max/2,array[0] - 0, l - array[n-1] );
write(res);

class Utility {
    static stringToInts(str) {
       let digits = [];
       for (let i = 0; i < str.length; i++)
          digits.push(parseInt(str.charAt(i)));
       return digits;
    }
    static parseToInts(str, separator) {
       let digits = [];
       Utility.forEach(str.split(separator), s => { digits.push(parseInt(s)); });
       return digits;
    }
    static forEach(arr, fnc) {
       for (let i = 0; i < arr.length; i++)
          fnc(arr[i]);
    }
    static max(p1, p2) {
       return p1 > p2 ? p1 : p2;
    }
    static reverse(arr) {
       let rarr = [];
       for (let i = arr.length - 1; i >= 0; i--)
          rarr.push(arr[i]);
       return rarr;
    }
    static range(n) {
       let range = [];
       for (let i = 1; i <= n; i++)
          range.push(i);
       return range;
    }
    static equals(arr1, arr2) {
       return JSON.stringify(arr1) == JSON.stringify(arr2);
    }
    static processStdin(afterCallback) {
       process.stdin.resume();
       process.stdin.setEncoding('utf-8');

       let inputString = '';

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

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

          afterCallback(inputString);
       });
    }
 }

function solve(input) {
    console.log(input);
    let d = Utility.parseToInts(input[0], ' ');
    let n = d[0], l = d[1];
    let A = Utility.parseToInts(input[1], ' ');
    A.sort((a, b) => a >= b);

    let maxDist = 0;
    if (n > 0) {
        if (A[0] != 0) maxDist = A[0];
        if (A[A.length - 1] != l) {
            let md = l - A[A.length - 1];
            if (md > maxDist) maxDist = md;
        }

        for (let i = 1; i < A.length; i++) {
            let md = (A[i] - A[i - 1]) / 2;
            if (md > maxDist) maxDist = md;
        }
    }
    console.log(maxDist.toFixed(10));
}

Utility.processStdin(solve);

class Utility {
    static stringToInts(str) {
       let digits = [];
       for (let i = 0; i < str.length; i++)
          digits.push(parseInt(str.charAt(i)));
       return digits;
    }
    static parseToInts(str, separator) {
       let digits = [];
       Utility.forEach(str.split(separator), s => { digits.push(parseInt(s)); });
       return digits;
    }
    static forEach(arr, fnc) {
       for (let i = 0; i < arr.length; i++)
          fnc(arr[i]);
    }
    static max(p1, p2) {
       return p1 > p2 ? p1 : p2;
    }
    static reverse(arr) {
       let rarr = [];
       for (let i = arr.length - 1; i >= 0; i--)
          rarr.push(arr[i]);
       return rarr;
    }
    static range(n) {
       let range = [];
       for (let i = 1; i <= n; i++)
          range.push(i);
       return range;
    }
    static equals(arr1, arr2) {
       return JSON.stringify(arr1) == JSON.stringify(arr2);
    }
    static processStdin(afterCallback) {
       process.stdin.resume();
       process.stdin.setEncoding('utf-8');

       let inputString = '';

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

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

          afterCallback(inputString);
       });
    }
 }

function solve(input) {
    let d = Utility.parseToInts(input[0], ' ');
    let n = d[0], l = d[1];
    let A = Utility.parseToInts(input[1], ' ');
    A = A.sort((a, b) => a - b);
    console.log(n);
    console.log(l);
    console.log(A);

    let maxDist = 0;
    if (n > 0) {
        if (A[0] != 0) maxDist = A[0];
        if (A[A.length - 1] != l) {
            let md = l - A[A.length - 1];
            if (md > maxDist) maxDist = md;
        }

        for (let i = 1; i < A.length; i++) {
            let md = (A[i] - A[i - 1]) / 2;
            if (md > maxDist) maxDist = md;
        }
    }
    console.log(maxDist.toFixed(10));
}

Utility.processStdin(solve);

class Utility {
    static stringToInts(str) {
       let digits = [];
       for (let i = 0; i < str.length; i++)
          digits.push(parseInt(str.charAt(i)));
       return digits;
    }
    static parseToInts(str, separator) {
       let digits = [];
       Utility.forEach(str.split(separator), s => { digits.push(parseInt(s)); });
       return digits;
    }
    static forEach(arr, fnc) {
       for (let i = 0; i < arr.length; i++)
          fnc(arr[i]);
    }
    static max(p1, p2) {
       return p1 > p2 ? p1 : p2;
    }
    static reverse(arr) {
       let rarr = [];
       for (let i = arr.length - 1; i >= 0; i--)
          rarr.push(arr[i]);
       return rarr;
    }
    static range(n) {
       let range = [];
       for (let i = 1; i <= n; i++)
          range.push(i);
       return range;
    }
    static equals(arr1, arr2) {
       return JSON.stringify(arr1) == JSON.stringify(arr2);
    }
    static processStdin(afterCallback) {
       process.stdin.resume();
       process.stdin.setEncoding('utf-8');

       let inputString = '';

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

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

          afterCallback(inputString);
       });
    }
 }

function solve(input) {
    let d = Utility.parseToInts(input[0], ' ');
    let n = d[0], l = d[1];
    let A = Utility.parseToInts(input[1], ' ');
    A.sort((a, b) => a >= b);

    let maxDist = 0;
    if (n > 0) {
        if (A[0] != 0) maxDist = A[0];
        if (A[A.length - 1] != l) {
            let md = l - A[A.length - 1];
            if (md > maxDist) maxDist = md;
        }

        for (let i = 1; i < A.length; i++) {
            let md = (A[i] - A[i - 1]) / 2;
            if (md > maxDist) maxDist = md;
        }
    }
    console.log(maxDist.toFixed(10));
}

Utility.processStdin(solve);

class Utility {
    static stringToInts(str) {
       let digits = [];
       for (let i = 0; i < str.length; i++)
          digits.push(parseInt(str.charAt(i)));
       return digits;
    }
    static parseToInts(str, separator) {
       let digits = [];
       Utility.forEach(str.split(separator), s => { digits.push(parseInt(s)); });
       return digits;
    }
    static forEach(arr, fnc) {
       for (let i = 0; i < arr.length; i++)
          fnc(arr[i]);
    }
    static max(p1, p2) {
       return p1 > p2 ? p1 : p2;
    }
    static reverse(arr) {
       let rarr = [];
       for (let i = arr.length - 1; i >= 0; i--)
          rarr.push(arr[i]);
       return rarr;
    }
    static range(n) {
       let range = [];
       for (let i = 1; i <= n; i++)
          range.push(i);
       return range;
    }
    static equals(arr1, arr2) {
       return JSON.stringify(arr1) == JSON.stringify(arr2);
    }
    static processStdin(afterCallback) {
       process.stdin.resume();
       process.stdin.setEncoding('utf-8');

       let inputString = '';

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

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

          afterCallback(inputString);
       });
    }
 }

function solve(input) {
    let d = Utility.parseToInts(input[0], ' ');
    let n = d[0], l = d[1];
    let A = Utility.parseToInts(input[1], ' ');
    A.sort((a, b) => a >= b);
    console.log(n);
    console.log(l);
    console.log(A);

    let maxDist = 0;
    if (n > 0) {
        if (A[0] != 0) maxDist = A[0];
        if (A[A.length - 1] != l) {
            let md = l - A[A.length - 1];
            if (md > maxDist) maxDist = md;
        }

        for (let i = 1; i < A.length; i++) {
            let md = (A[i] - A[i - 1]) / 2;
            if (md > maxDist) maxDist = md;
        }
    }
    console.log(maxDist.toFixed(10));
}

Utility.processStdin(solve);

class Utility {
    static stringToInts(str) {
       let digits = [];
       for (let i = 0; i < str.length; i++)
          digits.push(parseInt(str.charAt(i)));
       return digits;
    }
    static parseToInts(str, separator) {
       let digits = [];
       Utility.forEach(str.split(separator), s => { digits.push(parseInt(s)); });
       return digits;
    }
    static forEach(arr, fnc) {
       for (let i = 0; i < arr.length; i++)
          fnc(arr[i]);
    }
    static max(p1, p2) {
       return p1 > p2 ? p1 : p2;
    }
    static reverse(arr) {
       let rarr = [];
       for (let i = arr.length - 1; i >= 0; i--)
          rarr.push(arr[i]);
       return rarr;
    }
    static range(n) {
       let range = [];
       for (let i = 1; i <= n; i++)
          range.push(i);
       return range;
    }
    static equals(arr1, arr2) {
       return JSON.stringify(arr1) == JSON.stringify(arr2);
    }
    static processStdin(afterCallback) {
       process.stdin.resume();
       process.stdin.setEncoding('utf-8');

       let inputString = '';

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

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

          afterCallback(inputString);
       });
    }
 }

function solve(input) {
    let d = Utility.parseToInts(input[0], ' ');
    let n = d[0], l = d[1];
    let A = Utility.parseToInts(input[1], ' ');
    A = A.sort((a, b) => a >= b);
    console.log(n);
    console.log(l);
    console.log(A);

    let maxDist = 0;
    if (n > 0) {
        if (A[0] != 0) maxDist = A[0];
        if (A[A.length - 1] != l) {
            let md = l - A[A.length - 1];
            if (md > maxDist) maxDist = md;
        }

        for (let i = 1; i < A.length; i++) {
            let md = (A[i] - A[i - 1]) / 2;
            if (md > maxDist) maxDist = md;
        }
    }
    console.log(maxDist.toFixed(10));
}

Utility.processStdin(solve);

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

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

readline.on('close', () => {
    const [n, l] = input[0].split(' ').map(Number);
    const arr = input[1].split(' ').map(Number);
    arr.sort((a, b) => a - b);
    let dist = arr[0] - 0;
    if ((l - arr[arr.length - 1]) > dist) dist = l - arr[arr.length - 1];
    console.log(dist);
    for (let i = 1; i < arr.length; i++) {
        if (((arr[i] - arr[i - 1]) / 2) > dist) dist = (arr[i] - arr[i - 1]) / 2;
    }
    console.log(dist);
});

let solution = function (n, l, arr) {
  arr.sort((x, y) => (x - y))
  // let check = function(i) {
  //   let smallest = 0
  //   for(let x of arr) {
  //     let left = x - i
  //     let right = x + i
  //     if(left > smallest+1) return false
  //     smallest = right
  //   }
  //   return right >= l
  // }

  // let left = 1
  // let right = l
  // while(left > right) {
  //   let mid = Math.floor((left + right)/2)
  //   if(check(mid)) {
  //     right = mid-1
  //   } else {
  //     left = mid+1
  //   }
  // }
  // while(check(left)) {
  //   left--
  // }
  // return left+1
  let max = 0
  let first = arr[0]
  let last = l - arr[arr.length-1]
  for(let i = 1; i<arr.length; i++) {
    let right = arr[i]
    let left = arr[i-1]
    let x = (right - left)/2
    max = Math.max(max, x)
  }
  return Math.max(max, first, last)
}

// console.log(solution(7, 15, [15,5,3,7,9,14,0]))

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

let lineCount = 0
var n, l, arr

rl.on('line', (line) => {
  lineCount++
  if(lineCount === 1) {
    [n, l] = line.split(' ').map(x => parseInt(x))
  }
  if(lineCount === 2) {
    arr = line.split(' ').map(x => parseInt(x))
    // console.log(n, l, arr)
    result = solution(n, l, arr)
    // console.log(result)
  }
})

let fs = require('fs');

let txt = fs.readFileSync(0, "utf-8").split(/[\n\r]/).filter(data => data.length > 0);

for (let i = 0; i < txt.length; i += 2) {
    let info = txt[i].split(" ");
    doit(info[1] * 1, txt[i + 1].split(" ").filter(data => data.length > 0).map(data => data * 1).sort((a, b) => a - b));
}

function doit(n, tab) {
    let changes = tab[0];
    let g = (n - tab[tab.length - 1]);
    if (g > changes) chenges = g;
    for (let i = 1; i < tab.length; i++) {
        let r = (tab[i] - tab[i - 1]) / 2;
        if (changes < r) changes = r;
    }
    console.log(changes);

}

let fs = require('fs');

let txt = fs.readFileSync(0, "utf-8").split(/[\n\r]/).filter(data => data.length > 0);

for (let i = 0; i < txt.length; i+=2) {
    let info=txt[i].split(" ");
    doit(info[1] * 1, txt[i+1].split(" ").filter(data=>data.length>0).map(data=>data*1).sort((a,b)=>a-b));
}

function doit(n, tab) {
    let changes=tab[0];
    if((n-tab[tab.length-1])/2>changes)chenges=(n-tab[tab.length-1]);
    for (let i = 1; i < tab.length; i++) {
        if(changes<(tab[i]-tab[i-1])/2)changes=(tab[i]-tab[i-1])/2;
    }
    console.log(changes);

}