You receive some random elements as a space-delimited string. Check if the elements are part of an ascending sequence of integers starting with 1, with an increment of 1 (e.g. 1, 2, 3, 4).

Return:

* `0` if the elements can form such a sequence, and no number is missing ("not broken", e.g. `"1 2 4 3"`)
* `1` if there are any non-numeric elements in the input ("invalid", e.g. `"1 2 a"`)
* `n` if the elements are part of such a sequence, but some numbers are missing, and `n` is the lowest of them ("broken", e.g. `"1 2 4"` or `"1 5"`)


## Examples
```
"1 2 3 4"  ==>  return 0, because the sequence is complete

"1 2 4 3"  ==>  return 0, because the sequence is complete (order doesn't matter)

"2 1 3 a"  ==>  return 1, because it contains a non numerical character

"1 3 2 5"  ==>  return 4, because 4 is missing from the sequence

"1 5"      ==>  return 2, because the sequence is missing 2, 3, 4 and 2 is the lowest

```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def find_missing_number(sequence):
	

Solutions:
def find_missing_number(sequence):
	if not sequence:
		return 0
	try:
		sequence = set((int(a) for a in sequence.split()))
	except ValueError:
		return 1
	for b in range(1, max(sequence) + 1):
		if b not in sequence:
			return b
	return 0


def find_missing_number(sequence):
	try:
		numbers = sorted([int(x) for x in sequence.split()])
		for i in range(1, len(numbers) + 1):
			if i not in numbers:
				return i
	except ValueError:
		return 1
	return 0


def find_missing_number(sequence):
	try:
		sequence = [int(n) for n in sequence.split()]
	except ValueError:
		return 1
	for (i, n) in enumerate(sorted(sequence)):
		if n != i + 1:
			return i + 1
	return 0


def find_missing_number(sequence):
	try:
		seq = set(map(int, sequence.split()))
		return (set(range(1, 1 + max(seq, default=0))) - seq or {0}).pop()
	except:
		return 1


def find_missing_number(sequence: str) -> int:
	try:
		elements = set(map(int, sequence.split()))
	except ValueError:
		return 1
	return min(set(range(1, len(elements) + 1)) - elements or [0])


def find_missing_number(sequence):
	if not sequence:
		return 0
	if not sequence.replace(' ', '').isnumeric():
		return 1
	seq = list(map(int, sequence.split(' ')))
	result = [number for number in [x for x in range(1, max(seq))] if number not in seq]
	return 0 if not result else result[0]


def find_missing_number(sequence):
	ns = sequence.split()
	numbers = {int(x) for x in ns if x.isdigit()}
	if len(numbers) != len(ns):
		return 1
	for i in range(1, max(numbers, default=0) + 1):
		if i not in numbers:
			return i
	return 0


def find_missing_number(sequence):
	s = sequence.split()
	if all((el.isdigit() for el in s)):
		for i in range(1, len(s) + 1):
			if str(i) not in s:
				return i
		return 0
	return 1


def find_missing_number(sequence):
	sequence = sequence.strip().split()
	data = []
	for ch in sequence:
		if not ch.isdigit():
			return 1
		else:
			data.append(int(ch))
	if data == []:
		return 0
	else:
		data = sorted(data)
	pattern = list(range(1, len(data) + 1))
	if pattern == data:
		return 0
	else:
		for pair in zip(pattern, data):
			if pair[0] != pair[1]:
				return pair[0]


def find_missing_number(sequence):
	try:
		seq = sorted((int(i) for i in sequence.split()))
	except ValueError:
		return 1
	if seq and seq[0] != 1:
		return 1
	for (idx, nr) in enumerate(seq[:-1]):
		if nr + 1 != seq[idx + 1]:
			return nr + 1
	return 0


def find_missing_number(s):
	if not s:
		return 0
	elif s.replace(' ', '').isdigit():
		try:
			return [p[0] + 1 == p[1] for p in enumerate(sorted(map(int, s.split())))].index(False) + 1
		except ValueError:
			return 0
	else:
		return 1


def find_missing_number(sequence):
	try:
		numbers = list(map(int, sequence.split()))
	except ValueError:
		return 1
	if not numbers:
		return 0
	all_nums = list(range(1, max(numbers)))
	r = sorted(set(all_nums) - set(numbers))
	return r[0] if len(r) > 0 else 0


find_missing_number = lambda w: (lambda s: min(set(range(max(s))) - s or [0]))((set(w) <= set('0123456789 ') and set(map(int, w.split())) or {2}) | {w == ''})


from itertools import count

def find_missing_number(sequence):
	try:
		seq = sorted(map(int, sequence.split()))
		return next((a for (a, b) in zip(count(1), seq) if a != b))
	except ValueError:
		return 1
	except StopIteration:
		return 0


import re

def find_missing_number(sequence):
	if len(sequence) == 0:
		return 0
	elif not sequence.replace(' ', '').isnumeric():
		return 1
	list1 = [int(i) for i in sequence.split(' ')]
	maxNum = max(list1)
	if maxNum >= 10:
		for i in range(1, maxNum):
			s = str(i)
			if re.search('(:?(:?[^0-9]|^)' + s + ' | ' + s + '(:?[^0-9]|$))', sequence) == None:
				return i
	else:
		for i in range(1, maxNum):
			if str(i) not in sequence:
				return i
	return 0


def find_missing_number(s):
	try:
		nums = set(map(int, s.split()))
	except:
		return 1
	missing = [n for n in range(1, max(nums, default=0) + 1) if n not in nums]
	return min(missing, default=0)


def find_missing_number(seq):
	try:
		seq = [int(a) for a in seq.split()]
	except ValueError:
		return 1
	for num in range(1, len(seq) + 1):
		if num not in seq:
			return num
	return 0


def find_missing_number(sequence):
	s = sequence.split()
	try:
		s = [int(x) for x in s]
	except ValueError:
		return 1
	s.sort()
	for i in range(len(s)):
		if s[i] != i + 1:
			return i + 1
	return 0


def find_missing_number(sequence):
	if not sequence.replace(' ', '').isdigit():
		return 1 * bool(sequence)
	sequence = set((int(a) for a in sequence.split(' ')))
	missing = list(set(range(1, max(sequence))) - sequence)
	return 0 if not missing else missing[0]


def find_missing_number(sequence):
	items = sequence.split(' ')
	try:
		items = sorted((int(x) for x in items)) if sequence else []
	except ValueError:
		return 1
	for (i, x) in enumerate(items, 1):
		if i != x:
			return i
	return 0


def find_missing_number(sequence):
	v = 1
	try:
		for n in sorted(map(int, sequence.split())):
			if n != v:
				return v
			v += 1
	except:
		return 1
	return 0


def find_missing_number(sequence):
	arr = sequence.split(' ')
	if arr == ['']:
		return 0
	for i in range(0, len(arr)):
		try:
			arr[i] = int(arr[i])
		except ValueError:
			return 1
	c = 1
	while c in arr:
		c += 1
	if c > max(arr):
		return 0
	return c


def find_missing_number(s):
	if not s:
		return 0
	try:
		s = sorted((int(i) for i in s.split()))
	except:
		return 1
	return next((i + 1 for i in range(s[-1]) if i + 1 not in s), 0)


def find_missing_number(sequence):
	if not sequence:
		return 0
	sequenceList = list(sequence.split(' '))
	try:
		sequenceInt = [int(i) for i in sequenceList]
	except:
		return 1
	sequenceInt.sort()
	for (i, number) in enumerate(sequenceInt):
		if i + 1 != number:
			return i + 1
	return 0


def find_missing_number(sequence):
	try:
		l = sorted([int(x) for x in sequence.split()])
	except:
		return 1
	for (x, y) in zip(l, range(1, len(l) + 1)):
		if y != x:
			return y
	return 0


def find_missing_number(sequence):
	if len(sequence) == 0:
		return 0
	else:
		try:
			x = [int(i) for i in sequence.split()]
		except:
			return 1
		missing = set(range(1, max(x) + 1)) - set(x)
		if len(missing) == 0:
			return 0
		else:
			return list(missing)[0]


def find_missing_number(s):
	if s == '':
		return 0
	try:
		s = set(map(int, s.split(' ')))
	except ValueError:
		return 1
	try:
		return min(set(range(1, max(s))).difference(s))
	except ValueError:
		return 0


def find_missing_number(seq):
	try:
		seq = sorted(map(int, seq.split()))
	except ValueError:
		return 1
	if not seq:
		return 0
	if seq[0] != 1:
		return 1
	for (i, v) in enumerate(seq[:-1]):
		if v + 1 != seq[i + 1]:
			return v + 1
	return 0


def find_missing_number(sequence):
	if len(sequence) == 0:
		return 0
	num = sequence.split()
	if not all((n.isdigit() for n in num)):
		return 1
	num = [0] + sorted(map(int, num))
	return next((i for i in range(1, len(num)) if num[i] - num[i - 1] != 1), 0)


def find_missing_number(sequence):
	if not sequence:
		return 0
	try:
		s = set(map(int, sequence.split(' ')))
	except ValueError:
		return 1
	for i in range(len(s)):
		if not i + 1 in s:
			return i + 1
	return 0


def find_missing_number(sequence):
	if sequence == '':
		return 0
	if not sequence.isdigit or any((c.isalpha() for c in sequence)) or '_' in sequence:
		return 1
	s = sorted((int(num) for num in sequence.split(' ')))
	if s[-1] == len(s) and s[0] == 1:
		return 0
	for i in range(len(s)):
		if s[i] != i + 1:
			return i + 1


def find_missing_number(sequence):
	if sequence == '':
		return 0
	else:
		se = sequence.split()
		for j in se:
			if j.isdigit():
				continue
			else:
				return 1
		for i in range(1, len(se) + 1):
			if str(i) not in se:
				return i
		return 0


def find_missing_number(s):
	if any((x.isalpha() or x == '_' for x in s)):
		return 1
	s = sorted(map(int, s.split()))
	return 0 if not s or all((x in s for x in range(1, s[-1] + 1))) else min(set(range(1, s[-1] + 1)) - set(s))


def find_missing_number(sequence):
	if not sequence:
		return 0
	try:
		sequence = [int(el) for el in sequence.split(' ')]
	except:
		return 1
	sequence.sort()
	if sequence[0] != 1:
		return 1
	for i in range(1, len(sequence)):
		if sequence[i] != sequence[i - 1] + 1:
			return sequence[i - 1] + 1
	return 0


def find_missing_number(sequence):
	lst = sequence.split(' ')
	if sequence == '':
		return 0
	try:
		numbers = sorted([int(x) for x in lst])
	except ValueError:
		return 1
	if numbers == list(range(1, len(numbers) + 1)):
		return 0
	if numbers[0] == 2 and numbers == list(range(2, len(numbers) + 2)):
		return 1
	else:
		for i in range(len(numbers) - 1):
			if numbers[i] + 1 != numbers[i + 1]:
				return numbers[i] + 1


def find_missing_number(sequence):
	a = []
	for i in sequence.split():
		if i.isdigit():
			a.append(int(i))
		else:
			return 1
	if a == []:
		return 0
	for i in range(1, max(a) + 1):
		if not i in a:
			return i
	return 0


def find_missing_number(sequence):
	try:
		t = [int(i) for i in sequence.split()]
		st = set(range(1, len(t) + 1)) - set(t)
		return min(st) if st else 0
	except:
		return 1


def find_missing_number(sequence):
	if sequence == '':
		return 0
	try:
		sequence = set((int(x) for x in sequence.split()))
	except ValueError:
		return 1
	for w in range(1, max(sequence) + 1):
		if w not in sequence:
			return w
	return 0


def find_missing_number(sequence):
	if not sequence:
		return 0
	if not is_valid(sequence):
		return 1
	numbers = sorted([int(x) for x in sequence.split(' ')])
	n = 1
	for i in range(0, len(numbers)):
		if numbers[i] != n:
			return n
		n += 1
	return 0

def is_valid(sequence):
	numbers = sequence.split(' ')
	for a in numbers:
		if not a.isdigit():
			return False
	return True


def find_missing_number(sequence):
	if sequence == '':
		return 0
	if any((not x.isdigit() for x in sequence.split(' '))):
		return 1
	s = sorted(list(map(int, sequence.split(' '))))
	if s == list(range(1, max(s) + 1)):
		return 0
	else:
		return min((i for i in range(1, max(s) + 1) if i not in s))


def find_missing_number(sequence):
	try:
		l = [int(i) for i in sequence.split()]
		l.sort()
		for i in range(1, l[-1]):
			if i not in l:
				return i
		else:
			return 0
	except:
		return 1 if sequence != '' else 0


def find_missing_number(sequence):
	a = list(map(int, list(filter(str.isdigit, sequence.split()))))
	if len(sequence.split()) != len(a):
		return 1
	if a:
		for n in range(1, max(a) + 1):
			if n not in a:
				return n
	return 0


def find_missing_number(sequence):
	if not sequence:
		return 0
	arr = sequence.split(' ')
	if any((not ch.isdigit() for ch in arr)):
		return 1
	for n in range(1, len(arr) + 1):
		if str(n) not in arr:
			return n
	return 0


def find_missing_number(sequence):
	if sequence == '':
		return 0
	try:
		seq = sorted([int(s) for s in sequence.split(' ')])
	except:
		return 1
	a = list(range(1, seq[-1] + 1))
	return 0 if seq == a else list(set(a) - set(seq))[0]


def find_missing_number(s):
	if s == '':
		return 0
	a = s.split(' ')
	if not all([x.isdigit() for x in a]):
		return 1
	b = sorted([int(x) for x in a])
	c = list(range(1, b[-1] + 1))
	if b == c:
		return 0
	else:
		for x in c:
			if x not in b:
				return x
	return "I've missed something"


def find_missing_number(sequence: str):
	if not sequence:
		return 0
	try:
		sequence = [int(i) for i in sequence.split(' ')]
	except:
		return 1
	for i in range(1, max(sequence) + 1):
		if i not in sequence:
			return i
	return 0


def find_missing_number(s):
	if not s:
		return 0
	elif not all((x.isdigit() for x in s.split())):
		return 1
	s = sorted([int(i) for i in s.split()])
	if s[0] != 1:
		return 1
	a = [i for i in range(1, max(s) + 1) if i not in s]
	return a[0] if len(a) > 0 else 0


def find_missing_number(seq):
	if not seq:
		return 0
	elif not seq.replace(' ', '').isdecimal():
		return 1
	else:
		seq = set(map(int, seq.split()))
		full = set(range(1, max(seq) + 1))
		return 0 if seq == full else min(full - seq)


def find_missing_number(sequence):
	if sequence == '':
		return 0
	seq = sequence.split()
	if not ''.join(seq).isdigit():
		return 1
	seq = list(map(int, seq))
	qwe = [i for i in range(1, max(seq) + 1)]
	if len(seq) == len(qwe):
		return 0
	for i in range(1, max(seq) + 1):
		if i not in seq:
			return i
			break


def find_missing_number(sequence):
	if len(sequence) == 0:
		return 0
	sequence = sequence.split()
	int_sequence = sorted((int(d) for d in sequence if d.isdigit()))
	if len(sequence) != len(int_sequence):
		return 1
	control = [n for n in range(1, int_sequence[-1] + 1)]
	for (n, j) in zip(control, int_sequence):
		if n != j:
			return n
	return 0


def find_missing_number(sequence):
	try:
		a = set(map(int, sequence.split()))
		try:
			return min(set(range(1, max(a) + 1)) - set(a))
		except:
			return 0
	except:
		return 1


def find_missing_number(s):
	try:
		lst = sorted(map(int, s.split()))
		return next((x for (x, y) in zip(range(1, lst[-1] + 1), lst) if x != y), 0)
	except IndexError:
		return 0
	except ValueError:
		return 1


def find_missing_number(sequence):
	sequence = sequence.rsplit(sep=' ')
	if sequence == ['']:
		return 0
	for a in sequence:
		try:
			int(a)
		except ValueError:
			return 1
	sequence = [int(b) for b in sequence]
	for c in range(1, max(sequence) + 1):
		if c not in sequence:
			return c
	else:
		return 0


def find_missing_number(sequence):
	if sequence == '':
		return 0
	if [x for x in sequence.split(' ') if x.isnumeric() == False]:
		return 1
	m = max((int(x) for x in sequence.split(' ')))
	for x in range(1, m + 1):
		if str(x) not in sequence.split(' '):
			return x
	return 0


def find_missing_number(s):
	if s == '':
		return 0
	l = s.split(' ')
	for i in l:
		if not i.isdigit():
			return 1
	l = sorted([int(i) for i in l])
	for i in range(len(l)):
		if i + 1 != l[i]:
			return i + 1
	return 0


def find_missing_number(sequence):
	try:
		sequence = [int(num) for num in sequence.split()]
		nums = set(sequence)
		for i in range(1, len(sequence) + 1):
			if i not in nums:
				return i
		return 0
	except ValueError:
		return 1


def find_missing_number(s):
	l = s.split(' ')
	if s == '':
		return 0
	st = []
	for x in l:
		for c in l:
			if c.isalpha():
				st.append(c)
		if len(st) > 0:
			return 1
		elif sorted([x for x in l]) == [str(y) for y in range(1, len(l) + 1)]:
			return 0
		elif sorted([x for x in l]) != [str(y) for y in range(1, len(l) + 1)]:
			missing = []
			for a in range(1, len(l) + 1):
				if str(a) not in [x for x in l]:
					missing.append(int(a))
					return min(missing)


def find_missing_number(sequence):
	if not sequence:
		return 0
	try:
		l = [int(elem) for elem in sequence.split(' ')]
	except ValueError:
		return 1
	for i in range(1, len(l) + 1):
		if i not in l:
			return i
	return 0


def find_missing_number(sequence):
	if not sequence:
		return 0
	sequence = sequence.split()
	for item in sequence:
		if not item.isdigit():
			return 1
	sequence = sorted(list(map(int, sequence)))
	proper_seq = range(1, len(sequence) + 1)
	for (x, y) in zip(sequence, proper_seq):
		if x != y:
			return y
	return 0


def find_missing_number(sequence):
	if not sequence:
		return 0
	try:
		sequence = [int(elem) for elem in sequence.split()]
	except ValueError:
		return 1
	pattern = list(range(1, len(sequence) + 1))
	sequence.sort()
	for (idx, elem) in enumerate(sequence):
		if elem != pattern[idx]:
			return pattern[idx]
	return 0


def find_missing_number(sq):
	if sq == '':
		return 0
	try:
		arr = [int(e) for e in sq.split(' ')]
	except ValueError:
		return 1
	else:
		arr.sort()
		for i in range(0, len(arr)):
			if arr[i] != i + 1:
				return i + 1
		return 0


def find_missing_number(sequence):
	try:
		nums = list(map(int, sequence.split()))
		nums.sort()
		for i in range(len(nums)):
			if nums[i] != i + 1:
				return i + 1
		return 0
	except:
		return 1


def find_missing_number(sequence):
	if not sequence:
		return 0
	try:
		sequence = set(sorted((int(s) for s in sequence.split())))
		diff = set(range(1, max(sequence) + 1)) - sequence
		if not diff:
			return 0
		return min(diff)
	except:
		return 1


def find_missing_number(sequence):
	try:
		nums = list(map(int, sequence.split()))
	except:
		return 1
	max_num = max(nums) if nums else 0
	return min(set(range(1, max_num + 1)) - set(nums)) if set(range(1, max_num + 1)) != set(nums) else 0


def find_missing_number(sequence):
	if sequence == '':
		return 0
	sequence = sequence.split(' ')
	try:
		sequence = list(map(int, sequence))
		sequence.sort()
		maxi = max(sequence)
		for i in range(1, maxi + 1):
			if i not in sequence:
				return i
	except ValueError:
		return 1
	return 0


def find_missing_number(s):
	try:
		s = sorted(map(int, s.split()))
	except:
		return 1
	for (i, j) in enumerate(s[:-1]):
		if j + 1 != s[i + 1]:
			return j + 1
	return 0 if not s or s[0] == 1 else 1


def find_missing_number(sequence):
	sequence = sequence.split()
	if any((not n.isdigit() for n in sequence)):
		return 1
	sequence = sorted((int(n) for n in sequence))
	for (i, n) in enumerate(sequence, 1):
		if int(n) != i:
			return i
	return 0


def find_missing_number(sequence):
	if len(sequence) == 0:
		return 0
	l = sequence.split()
	try:
		l = list(map(int, l))
		s1 = set(l)
		s2 = list(range(1, max(l) + 1))
		s2 = set(s2)
		dif = s2.difference(s1)
		if len(dif) != 0:
			return next(iter(dif))
		else:
			return 0
	except ValueError:
		return 1


def find_missing_number(sequence):
	try:
		if not sequence:
			return 0
		elements = list(map(int, sequence.split(' ')))
		start = 1
		for element in sorted(elements):
			if element != start:
				return start
			start += 1
		return 0
	except:
		return 1


def find_missing_number(sequence):
	try:
		return next((i for (i, x) in enumerate(sorted(map(int, sequence.split())), 1) if i != x), 0)
	except:
		return 1


def find_missing_number(sq):
	num = 0
	sq = sq.split()
	try:
		sq = list(map(int, sq))
		sq = sorted(sq)
		for i in sq:
			num += 1
			if i != num:
				return num
		return 0
	except ValueError:
		return 1


def find_missing_number(sequence):
	if sequence == '':
		return 0
	x = sequence.split()
	result = []
	for i in x:
		if i.isdigit() == False:
			return 1
		elif i.isdigit() == True:
			result.append(int(i))
	result.sort()
	start = 0
	for i in range(len(result)):
		if result[i] == start + 1:
			start = start + 1
		else:
			prev = start
			break
	else:
		return 0
	return prev + 1


def find_missing_number(s):
	if not s:
		return 0
	try:
		arr = list(map(int, s.split()))
		(mi, mx) = (min(arr), max(arr))
		for i in range(1, mx + 1):
			if i not in arr:
				return i
		return 0
	except:
		return 1


def find_missing_number(sequence):
	if not sequence:
		return 0
	try:
		list = [int(a) for a in sequence.split()]
		for i in range(1, len(list) + 1):
			if i not in list:
				return i
	except ValueError:
		return 1
	return 0


def find_missing_number(sequence):
	try:
		nums = set(map(int, sequence.split()))
		try:
			return min((c for c in range(1, max(nums)) if c not in nums))
		except:
			return 0
	except:
		return 1


def find_missing_number(sequence):
	if not sequence:
		return 0
	if sequence.replace(' ', '').isnumeric():
		sequence = sorted((int(i) for i in sequence.split(' ')))
		for i in range(1, sequence[len(sequence) - 1]):
			if i not in sequence:
				return i
		return 0
	return 1


def find_missing_number(s):
	try:
		l = sorted([int(i) for i in s.split()])
	except:
		return 1
	if l == []:
		return 0
	a = [i for (i, x) in enumerate(l, min(l))]
	b = [x for (i, x) in enumerate(l, min(l))]
	if a == b and a[0] == 1:
		return 0
	c = [i for (i, x) in enumerate(l, 1)]
	d = [x for (i, x) in enumerate(l)]
	return min([i for i in c if i not in d])


def find_missing_number(sequence):
	if not sequence:
		return 0
	elif not sequence.replace(' ', '').isdigit():
		return 1
	new_seq = list(map(int, sequence.split()))
	try:
		ans = min(set(range(1, max(new_seq) + 1)).difference(set(new_seq)))
		return ans
	except:
		return 0


def find_missing_number(sequence):
	if not sequence:
		return 0
	lst = sequence.split(' ')
	if not all([el.isdigit() for el in lst]):
		return 1
	lst = list([int(el) for el in lst])
	max_seq = max(lst)
	for el in range(1, max_seq + 1):
		if el not in lst:
			return el
	return 0


def find_missing_number(sequence):
	if not sequence:
		return 0
	items = sequence.split(' ')
	numbers = []
	for item in items:
		try:
			numbers.append(int(item))
		except ValueError:
			return 1
	numbers.sort()
	if numbers[0] != 1:
		return 1
	for (i, x) in enumerate(numbers[:-1]):
		if numbers[i + 1] != x + 1:
			return x + 1
	return 0


def find_missing_number(sequence):
	s = sequence.split()
	if s == []:
		return 0
	try:
		s = list(map(int, s))
	except:
		return 1
	for i in range(1, max(s) + 1):
		if i not in s:
			return i
	return 0


def find_missing_number(sequence):
	if not sequence:
		return 0
	l = sequence.split()
	sd = ''.join(l)
	if sd.isdigit():
		l = [int(i) for i in l]
		for (idx, el) in enumerate(sorted(l), 1):
			if el != idx:
				return idx
		return 0
	return 1


def find_missing_number(sequence):
	if len(sequence) < 1:
		return 0
	try:
		sequence = [int(item) for item in sequence.split(sep=' ')]
	except ValueError:
		return 1
	else:
		for item in range(1, len(sequence) + 1):
			if item not in sequence:
				return item
	return 0


def find_missing_number(seq):
	if not seq:
		return 0
	try:
		numbers = sorted(map(int, seq.split(' ')))
		for i in range(len(numbers)):
			if numbers[i] != i + 1:
				return i + 1
		return 0
	except:
		return 1


def find_missing_number(sequence):
	if sequence == '':
		return 0
	tmp = []
	for i in sequence.split(' '):
		try:
			tmp.append(int(i))
		except:
			return 1
	t = 0
	print(tmp)
	for i in sorted(tmp):
		if t + 1 == i:
			t += 1
			continue
		else:
			return t + 1
	return 0


def find_missing_number(sequence):
	missing = []
	l = sequence.split()
	for i in range(1, len(l) + 1):
		if not l[i - 1].isdigit():
			return 1
		if str(i) not in l:
			missing.append(i)
	return min(missing) if missing else 0


def find_missing_number(sequence):
	if sequence:
		for i in sequence:
			if i not in '0123456789 ':
				return 1
				break
		strArr = sequence.split()
		Arr = [int(i) for i in strArr]
		Arr.sort()
		check = [i for i in range(1, max(Arr) + 1)]
		for i in check:
			if i not in Arr:
				return i
				break
		return 0
	else:
		return 0


def find_missing_number(s):
	if len(s) < 1:
		return 0
	try:
		s = sorted((int(x) for x in s.split()))
	except:
		return 1
	for (c, x) in enumerate(s, 1):
		if c != int(x):
			return c
	return 0


def find_missing_number(x):
	try:
		x = sorted(list(map(lambda i: int(i), x.split())))
		for i in range(1, len(x) + 1):
			if x[i - 1] != i:
				return i
		return 0
	except:
		return 1


def find_missing_number(sequence):
	if sequence == '':
		return 0
	elif not all([x.isdigit() for x in sequence.split()]):
		return 1
	else:
		s = sorted(sequence.split(), key=lambda x: int(x))
		print(int(s[0]))
		for x in range(len(s) - 1):
			if int(s[x + 1]) - int(s[x]) != 1:
				return int(s[x]) + 1
			elif int(s[0]) != 1:
				return 1
			elif len(s) == int(s[-1]):
				return 0


def find_missing_number(s):
	s = s.split()
	if not all((x.isdigit() for x in s)):
		return 1
	r = range(1, len(s) + 1)
	for x in r:
		if str(x) not in s:
			return x
	return 0


def find_missing_number(sequence):
	if sequence == '':
		return 0
	sequence = sequence.split()
	if any((not x.isdigit() for x in sequence)):
		return 1
	sequence = set((int(x) for x in sequence))
	if sequence == set(range(1, max(sequence) + 1)):
		return 0
	else:
		return min(set(range(1, max(sequence) + 1)).difference(sequence))


def find_missing_number(sequence):
	if sequence == '':
		return 0
	try:
		sq = [int(x) for x in sequence.split()]
	except:
		return 1
	(mini, maxi) = (min(sq), max(sq))
	for x in range(mini, maxi + 1):
		if x not in sq:
			return x
	return mini - 1


def find_missing_number(sequence):
	try:
		seq = [int(e) for e in sequence.split()]
	except ValueError:
		return 1
	for i in range(1, len(seq) + 1):
		if i not in seq:
			return i
	return 0