Vladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is not as easy as it sounds: the question Vladik face now is to find the cheapest way to get to the olympiad.

Vladik knows n airports. All the airports are located on a straight line. Each airport has unique id from 1 to n, Vladik's house is situated next to the airport with id a, and the place of the olympiad is situated next to the airport with id b. It is possible that Vladik's house and the place of the olympiad are located near the same airport. 

To get to the olympiad, Vladik can fly between any pair of airports any number of times, but he has to start his route at the airport a and finish it at the airport b.

Each airport belongs to one of two companies. The cost of flight from the airport i to the airport j is zero if both airports belong to the same company, and |i - j| if they belong to different companies.

Print the minimum cost Vladik has to pay to get to the olympiad.


-----Input-----

The first line contains three integers n, a, and b (1 ≤ n ≤ 10^5, 1 ≤ a, b ≤ n) — the number of airports, the id of the airport from which Vladik starts his route and the id of the airport which he has to reach. 

The second line contains a string with length n, which consists only of characters 0 and 1. If the i-th character in this string is 0, then i-th airport belongs to first company, otherwise it belongs to the second.


-----Output-----

Print single integer — the minimum cost Vladik has to pay to get to the olympiad.


-----Examples-----
Input
4 1 4
1010

Output
1
Input
5 5 2
10110

Output
0


-----Note-----

In the first example Vladik can fly to the airport 2 at first and pay |1 - 2| = 1 (because the airports belong to different companies), and then fly from the airport 2 to the airport 4 for free (because the airports belong to the same company). So the cost of the whole flight is equal to 1. It's impossible to get to the olympiad for free, so the answer is equal to 1. 

In the second example Vladik can fly directly from the airport 5 to the airport 2, because they belong to the same company.

Difficulty: EASY
Tags: Greedy algorithms

Implementation

Constructive algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
nabe = input().split()
raw = input()
world = [int(a) for a in raw]
a = int(nabe[1]) - 1
b = int(nabe[2]) - 1
if world[a] == world[b]:
	print(0)
else:
	print(1)


(n, a, b) = list(map(int, input().split()))
s = input()
print(int(s[a - 1]) ^ int(s[b - 1]))


(n, a, b) = list(map(int, input().split()))
arr = input()
print(abs(int(arr[b - 1]) - int(arr[a - 1])))


(n, a, b) = map(int, input().split(' '))
identity = list(input())
print(abs(int(identity[b - 1]) - int(identity[a - 1])))


(n, a, b) = [int(i) for i in input().split()]
air = input()
if air[a - 1] == air[b - 1] or a == b:
	print('0')
elif air[a - 1] != air[b - 1]:
	print('1')


(n, a, b) = list(map(int, input().split()))
line = []
aa = input()
for i in range(n):
	line += [int(aa[i])]
print(0 + (line[a - 1] != line[b - 1]))


(_, a, b) = map(int, input().split())
s = input()
a -= 1
b -= 1
if s[a] == s[b]:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
s = input()
s1 = s[a - 1]
s2 = s[b - 1]
if s1 == s2:
	print(0)
else:
	print(1)


try:
	total = input()
	n = int(total.split(' ')[0])
	a = int(total.split(' ')[1]) - 1
	b = int(total.split(' ')[2]) - 1
	atemp = a
	airports = str(input())
	if n >= 1 and n <= 10 ** 5 and (a >= 0) and (b >= 0) and (a <= n - 1) and (b <= n - 1):
		while True:
			closest = 0
			for i in range(b, n):
				if airports[i] == airports[a]:
					closest = i
					break
			for i in range(b, -1, -1):
				if airports[i] == airports[a]:
					if abs(closest - b) > abs(i - b):
						closest = i
					break
			a = closest
			if a == b:
				break
			if b - a < 0:
				a -= 1
			else:
				a += 1
		if airports[atemp] == airports[b]:
			print(0)
		else:
			print(1)
except:
	pass


(n, ini, fim) = [int(i) for i in input().split()]
mapa = input()
ini -= 1
fim -= 1
if mapa[ini] == mapa[fim]:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
s = str(input())
if s[a - 1] == s[b - 1]:
	print(0)
else:
	print(abs(int(s[a - 1]) - int(s[b - 1])))


(n, a, b) = list(map(int, input().split(' ')))
mas = list(map(int, input()))
print(abs(mas[a - 1] - mas[b - 1]))


(n, a, b) = map(int, input().split())
l = list(input())
if l[a - 1] == l[b - 1]:
	print(0)
else:
	print(1)


(n, a, b) = (int(z) for z in input().split())
s = input()
if s[a - 1] == s[b - 1]:
	print(0)
else:
	print(1)


__author__ = 'Alexander'
(n, a, b) = map(int, input().split())
t = input()
if t[a - 1] != t[b - 1]:
	print(1)
else:
	print(0)


import sys
import math
import collections
import heapq
import decimal
input = sys.stdin.readline
(n, a, b) = (int(i) for i in input().split())
l = list(input())
if l[a - 1] == l[b - 1]:
	print(0)
else:
	print(1)


(n, a, b) = list(map(int, input().split()))
secondLine = input()
airports = list(secondLine)
if airports[a - 1] == airports[b - 1]:
	print(0)
else:
	print(1)


tmp = input().split(' ')
n = int(tmp[0])
a = int(tmp[1])
b = int(tmp[2])
str = input()
if str[a - 1] == str[b - 1]:
	print('0')
else:
	print('1')


def main():
	try:
		while True:
			(n, a, b) = map(int, input().split())
			s = input()
			a -= 1
			b -= 1
			print(int(s[a] != s[b]))
	except EOFError:
		pass
main()


def compute(a, b, airports):
	if a == b or airports[a] == airports[b]:
		return 0
	if a > b:
		temp = b
		b = a
		a = temp
	return 1
(n, a, b) = map(int, input().split())
airports = input()
print(compute(a - 1, b - 1, airports))


((_, a, b), owners) = (map(int, input().split()), '_' + input())
print(int(owners[a] != owners[b]))


(_, a, b) = map(int, input().split())
c = input()
print(int(not c[a - 1] == c[b - 1]))


nums = list(map(int, input().split()))
owners = list(map(int, input()))
if owners[nums[1] - 1] is owners[nums[2] - 1]:
	print('0')
else:
	print('1')


(n, a, b) = list(map(int, input().split()))
p = list(input())
if a == b:
	print(0)
elif p[a - 1] != p[b - 1]:
	print(1)
else:
	print(0)


(n, a, b) = map(int, input().split())
k = input()
if k[a - 1] == k[b - 1]:
	print(0)
else:
	print(1)


val = input()
store = val.split()
n = int(store[0])
a = int(store[1])
b = int(store[2])
airport_code = input()
if airport_code[a - 1] == airport_code[b - 1]:
	print(0)
else:
	print(1)


(n, a, b) = input().split()
stro = input()
if stro[int(a) - 1] == stro[int(b) - 1]:
	print(0)
else:
	print(1)


import sys
(n, a, b) = map(int, input().split())
s = input()
if s[a - 1] == s[b - 1]:
	print(0)
else:
	print(1)


(n, a, b) = [int(x) for x in input().split()]
airports = [int(x) for x in input()]
if a == b:
	print(0)
	exit()
start_air = airports[a - 1]
end_air = airports[b - 1]
if start_air == end_air:
	print(0)
	exit()
if a > b:
	a -= 1
	b -= 2
	c = -1
elif a < b:
	a -= 1
	b -= 1
	c = 1
int_air = 0
for i in range(a, b, c):
	if airports[i] == end_air:
		int_air = i + 1
		break
print(abs(start_air - end_air))


from sys import stdin, stdout
(a, x, y) = list(map(int, input().split()))
length = input()
print(0 if length[x - 1] == length[y - 1] else 1)


def input_ints():
	return list(map(int, input().split()))

def solve():
	(n, a, b) = input_ints()
	s = input()
	print(int(s[a - 1] != s[b - 1]))
solve()


(n, i, j) = list(map(lambda x: int(x), input().split()))
s = input()
if s[i - 1] == s[j - 1]:
	print(0)
else:
	print(1)


nab = input().split(' ')
(n, a, b) = [int(x) for x in nab]
a -= 1
b -= 1
airports = input()
if airports[a] == airports[b]:
	print(0)
else:
	print(1)


import sys
(n, a, b) = map(int, sys.stdin.readline().split())
s = input()
a -= 1
b -= 1
small = min(a, b)
big = max(a, b)
ans = 0
if s[small] != s[big]:
	ans = 1
print(ans)


read = lambda : map(int, input().split())
(n, a, b) = read()
s = ' ' + input()
if s[a] == s[b]:
	print(0)
	exit()
else:
	print(1)


import sys

def calculate(lines):
	(n, a, b) = [int(i) for i in lines[0].split()]
	start = a - 1
	end = b - 1
	air = lines[1]
	if air[start] == air[end]:
		print(0)
	else:
		print(1)
calculate(sys.stdin.readlines())


(n, a, b) = map(int, input().split())
S = input()
ma1 = 1000000000
ma2 = 1000000000
if a > b:
	c = a
	a = b
	b = c
g = 0
for i in range(a - 1, b):
	if S[i] == S[b - 1]:
		ma1 = abs(i - a + 1 + g)
		break
	elif a - 1 != i:
		g = g - 1
g = 0
for i in range(a - 1, -1, -1):
	if S[i] == S[b - 1]:
		ma1 = min(ma1, abs(i - a + 1) + g)
		break
	elif i != a - 1:
		g = g - 1
g = 0
for i in range(b - 1, n):
	if S[i] == S[a - 1]:
		ma2 = abs(i - b + 1 + g)
		break
	elif i != b - 1:
		g = g - 1
g = 0
for i in range(b - 1, -1, -1):
	if S[i] == S[a - 1]:
		ma2 = min(ma2, abs(i - b + 1) + g)
		break
	elif i != b - 1:
		g = g - 1
print(min(ma1, ma2))


(a, b, c) = map(int, input().split())
h = input()
k = 0
l = 0
h = 'a' + h
if h[b] == h[c]:
	print(0)
else:
	print(1)


(n, s, e) = [int(item) for item in input().split()]
bin = input()
if bin[s - 1] == bin[e - 1]:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
s = input()
first = min(a, b)
second = max(a, b)
if s[first - 1] == s[second - 1]:
	print('0')
else:
	print('1')


(n, a, b) = [int(x) for x in input().split()]
airport = list(input())
if airport[a - 1] != airport[b - 1]:
	print(1)
else:
	print(0)


def vla_air(n, a, b, s):
	x = s[a - 1]
	y = s[b - 1]
	if x == y:
		return 0
	if a == b:
		return 0
	if a > b or a < b:
		return 1
(n, a, b) = list(map(int, input().strip().split()))
s = str(input())
print(vla_air(n, a, b, s))


(n, a, b) = map(int, input().split())
a -= 1
b -= 1
s = input()
if s[a] == s[b]:
	print(0)
elif '01' in s:
	print(1)
elif '10' in s:
	print(1)
else:
	print(0)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from heapq import *
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 10 ** 9 + 7

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	(n, a, b) = sep()
	type = inp()
	if type[a - 1] == type[b - 1]:
		print(0)
	else:
		print(1)
testcase(1)


(n, a, b) = [int(i) for i in input().split()]
airport = input()
if airport[a - 1] == airport[b - 1]:
	print(0)
else:
	print(1)


x = input().split()
y = input()
z = []
for i in y:
	z.append(i)
if y[int(x[1]) - 1] == y[int(x[2]) - 1]:
	print('0')
elif y[int(x[1]) - 1] != y[int(x[2]) - 1]:
	print('1')


(n, a, b) = map(int, input().split())
x = str(input())
if x[a - 1] == x[b - 1]:
	print(0)
else:
	print(1)


(length, start, end) = map(int, input().split())
data = input()
if data[end - 1] == data[start - 1]:
	print('0')
else:
	print('1')


def main():
	(n, a, b) = map(int, input().split())
	s = input()
	if s[a - 1] == s[b - 1]:
		print(0)
	else:
		print(1)
main()


(n, a, b) = map(int, input().split())
string = input()
print(int(string[a - 1]) ^ int(string[b - 1]))


(n, a, b) = list(map(int, input().split()))
x = input()
y = [0] * n
for i in range(n):
	y[i] = int(x[i])
if x[a - 1] == x[b - 1]:
	print('0')
else:
	print('1')


a = list(map(int, input().split()))
b = input()
if b[a[1] - 1] == b[a[2] - 1]:
	print(0)
else:
	print(1)


nums = [int(x) for x in input().split(' ')]
size = nums[0]
start = nums[1] - 1
end = nums[2] - 1
airport = input()
result = 0 if airport[start] == airport[end] else 1
print(result)


(m, a, b) = map(int, input().split())
n = input()
(k, l, pp) = [n[a - 1], n[b - 1], []]
if l == k:
	print('0')
else:
	print('1')


(n, a, b) = map(int, input().split())
s = input().strip()
ans = 0
if s[a - 1] == s[b - 1]:
	print(0)
else:
	print(1)


s = input().split()
n = int(s[0])
a = int(s[1]) - 1
b = int(s[2]) - 1
s = input()
if s[a] == s[b]:
	print(0)
else:
	print(1)


(n, a, b) = [int(x) for x in input().split()]
ports = [int(x) for x in input()]
if ports[a - 1] == ports[b - 1]:
	print(0)
else:
	print(1)


from sys import argv, exit

def get_str():
	return input()

def get_int():
	return int(input())

def get_ints(sep=' '):
	if not sep:
		return [int(c) for c in input()]
	return [int(i) for i in input().split(sep)]

def prnt(*args):
	if '-v' in argv:
		print(*args)

def ir(aps, i):
	return i >= 0 and i < len(aps)
l1 = get_ints()
n = l1[0]
start = l1[1]
end = l1[2]
aps = get_ints('')
start -= 1
end -= 1
total = 0
if aps[start] == aps[end]:
	print(0)
	exit(0)
else:
	print(1)


(n, a, b) = list(map(int, input().split(' ')))
s = input()
if a == b or s[a - 1] == s[b - 1]:
	print('0')
else:
	print('1')


(n, a, b) = [int(i) for i in input().split()]
s = input()
(a, b) = (min(a, b), max(a, b))
companya = s[a - 1]
companyb = s[b - 1]
if companya == companyb:
	print(0)
else:
	print(1)


s = [int(n) - 1 for n in input().split()]
z = [int(n) for n in input()]
if z[s[1]] == z[s[2]]:
	print(0)
else:
	print(1)


(n, a, b) = input().split(' ')
n = int(n)
a = int(a)
b = int(b)
num = input()
if num[a - 1] == num[b - 1]:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
a -= 1
b -= 1
L = input()
if L[a] == L[b]:
	print(0)
	exit()
if a == b:
	print(0)
	exit()
print(1)


import math
inp = [int(a) for a in input().split(' ')]
get = list(input())
start = inp[1] - 1
end = inp[2] - 1
if get[start] == get[end]:
	print('0')
else:
	print('1')


(n, a, b) = list(map(int, input().split()))
string = list(map(int, input()))
summa = 0
if string[a - 1] == string[b - 1]:
	summa = 0
else:
	summa = 1
print(summa)


(n, a, b) = [int(i) for i in input().split()]
a = a - 1
b = b - 1
airports = str(input())
if airports[b] == airports[a]:
	print(0)
else:
	print(1)


from sys import stdin
(N, A, B) = map(int, stdin.readline().rstrip().split())
companies = [x == '1' for x in stdin.readline().rstrip()]
if companies[A - 1] == companies[B - 1]:
	print(0)
else:
	print(1)


read = lambda : list(map(int, input().split()))
(n, a, b) = read()
s = ' ' + input()
if s[a] == s[b]:
	print(0)
	return
else:
	print(1)


(sink, n, m) = map(int, input().split())
a = [int(x) for x in input()]
print(abs(a[n - 1] - a[m - 1]))


import math
from decimal import *
import random
mod = int(1000000000.0) + 7
(n, a, b) = map(int, input().split())
arr = list(input())
if arr[a - 1] == arr[b - 1]:
	print(0)
else:
	print(1)


(n, a, b) = [int(i) for i in input().split(' ')]
s = input().strip()
if s[a - 1] == s[b - 1]:
	print(0)
else:
	print(1)


def minimum_cost_between_airports(vladiks_house, olympiad, airports):
	return abs(airports[vladiks_house - 1] - airports[olympiad - 1])
first_line = input().split()
vladiks_house = int(first_line[1])
olympiad = int(first_line[2])
airports = [int(i) for i in input()]
print(minimum_cost_between_airports(vladiks_house, olympiad, airports))


(n, a, b) = map(int, input().split())
s = input()
if s[a - 1] == s[b - 1]:
	print(0)
	exit()
if s[a - 1] == '1':
	l = s[:a - 1].find('0')
	r = s[a:].find('0')
	if l < 0:
		l = -10 ** 6
	if r < 0:
		r = 10 ** 6
else:
	l = s[:a - 1].find('1')
	r = s[a:].find('1')
	if l < 0:
		l = -10 ** 6
	if r < 0:
		r = 10 ** 6
ans = min(a - 1 - l, r + 1)
if ans > 1:
	ans = 1
print(ans)


(n, a, b) = map(int, input().split())
l = input()
print(int(l[a - 1] != l[b - 1]))


(a, x, y) = map(int, input().split())
b = input()
print([1, 0][b[x - 1] == b[y - 1]])


(a, b, c) = map(int, input().split())
d = input()
if d[b - 1] != d[c - 1]:
	print(1)
else:
	print(0)


import sys
(n, a, b) = map(int, sys.stdin.readline().split())
s = input().strip()
if s[a - 1] == s[b - 1]:
	print(0)
else:
	print(1)


from sys import stdin
(N, A, B) = map(int, stdin.readline().split())
bits = stdin.readline()
print(int(bits[A - 1] != bits[B - 1]))


(n, a, b) = map(int, input().split())
(a, b) = (a - 1, b - 1)
s = input()
pa = s[a]
pb = s[b]
if pa == pb:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
i = input()
air_a = i[a - 1]
air_b = i[b - 1]
if air_a == air_b:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
lis = [i for i in input().strip()]
if lis[a - 1] == lis[b - 1]:
	print(0)
else:
	print(1)


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))
(n, a, b) = map(int, input().split())
s = list(map(int, input()))
if a == b:
	print(0)
elif s[a - 1] == s[b - 1]:
	print(0)
else:
	print(1)


cases = input().split()
n = int(cases[0])
a = int(cases[1])
b = int(cases[2])
string = input()
a_type = 0
b_type = 0
find_b = False
more = False
b_index = 0
a_index = 0
for i in range(len(string)):
	if i + 1 == a:
		a_type = string[i]
		a_index = i
	if i + 1 == b:
		b_type = string[i]
		b_index = i
		find_b = True
if a_type == b_type:
	print(0)
else:
	print(1)


import sys
import math
import bisect

def solve(s, a, b):
	n = len(s)
	if s[a] == s[b]:
		return 0
	return 1

def main():
	(n, a, b) = map(int, input().split())
	a -= 1
	b -= 1
	s = input()
	ans = solve(s, a, b)
	print(ans)
main()


masuk = input().split()
(n, a, b) = (masuk[0], masuk[1], masuk[2])
comp = list(input())
if comp[int(a) - 1] == comp[int(b) - 1]:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
z = input().strip()
print((z[a - 1] != z[b - 1]) + 0)


(n, a, b) = map(int, input().split())
s = input()
print(abs(int(s[a - 1]) - int(s[b - 1])))


a = list(map(int, input().split()))
b = input()
print(int(b[a[1] - 1] != b[a[2] - 1]))


(a, b, c) = [int(x) for x in input().split()]
b -= 1
c -= 1
x = None
s = input()
if b == c:
	print(0)
else:
	for (i, d) in enumerate(s):
		if x is not None:
			if i == b or i == c:
				if x == d:
					print(0)
				else:
					print(1)
				break
		elif i == b or i == c:
			x = d


(n, a, b) = map(int, input().split())
airports = [int(x) for x in input().strip()]
print(0 if airports[a - 1] == airports[b - 1] else 1)


(n, a, b) = input().split()
airports = input()
if airports[int(a) - 1] != airports[int(b) - 1]:
	print(1)
else:
	print(0)


def ri():
	return map(int, input().split())
(n, a, b) = ri()
ap = input()
a -= 1
b -= 1
if ap[a] == ap[b]:
	print(0)
	exit()
cost = 10 ** 5 + 1
j = 0
for i in range(1, n - a):
	if ap[a] != ap[a + i]:
		cost = min(cost, i - j)
		break
	else:
		j += 1
j = 0
for i in range(1, a + 1):
	if ap[a] != ap[a - i]:
		cost = min(cost, i - j)
		break
	else:
		j += 1
j = 0
for i in range(1, n - b):
	if ap[b] != ap[b + i]:
		cost = min(cost, i - j)
		break
	else:
		j += 1
j = 0
for i in range(1, b + 1):
	if ap[b] != ap[b - i]:
		cost = min(cost, i - j)
		break
	else:
		j += 1
print(cost)


(n, a, b) = input().split(' ')
c = input()
if c[int(a) - 1] != c[int(b) - 1]:
	print(1)
else:
	print(0)


def main():
	from sys import stdin, stdout
	lines = stdin.readlines()
	line = lines[0].split()
	(n, a, b) = tuple(map(int, line))
	airports = lines[1]
	stdout.write('0\n' if airports[a - 1] == airports[b - 1] else '1\n')
main()


l = list(map(int, input().split()))
x = list(input())
if x[l[1] - 1] == x[l[2] - 1]:
	print(0)
else:
	print(1)


w = input().split()
(n, a, b) = (int(w[0]), int(w[1]), int(w[2]))
v = input()
co = []
for i in range(len(v)):
	co.append(int(v[i]))
tc = co[a - 1]
dc = co[b - 1]
if tc == dc:
	print('0')
else:
	print('1')


(n, i, j) = map(int, input().split())
c = input()
i -= 1
j -= 1
if c[i] == c[j]:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
arr = input()
v = 0
if arr[a - 1] == arr[b - 1]:
	print(0)
else:
	print(1)


(N, a, b) = [int(x) for x in input().strip().split(' ')]
airports = input().strip()
airports = [int(x) for x in airports]
print(abs(airports[a - 1] - airports[b - 1]))


(n, a, b) = map(int, input().split())
s = input()
e = list(s)
d = 0
c = 0
if a > b:
	(a, b) = (b, a)
for i in range(n + 1):
	if a == i:
		d = e[i - 1]
	if b == i:
		c = e[i - 1]
print(abs(int(d) - int(c)))


def min_cost(a, b, l):
	return (l[a - 1] != l[b - 1]) + 0
(n, a, b) = map(int, input().split())
l = input()
print(min_cost(a, b, l))


def minimum_cost_between_airports(vladiks_house, olympiad, airports):
	return 1 if airports[vladiks_house] != airports[olympiad] else 0
first_line = input().split()
(_, vladiks_house, olympiad) = (int(i) for i in first_line)
airports = list(input())
print(minimum_cost_between_airports(vladiks_house - 1, olympiad - 1, airports))


(n, a, b) = map(int, input().split())
s = input()
w = int(s[a - 1])
x = int(s[b - 1])
print(abs(w - x))


(n, a, b) = map(int, input().split())
x = input()
print(int(not x[a - 1] == x[b - 1]))


(n, x, y) = map(int, input().split())
s1 = input()
if s1[x - 1] == s1[y - 1]:
	print(0)
else:
	print(1)


(n, st, ed) = map(int, input().split())
s = input()
print(int(s[st - 1] != s[ed - 1]))


(n, m, k) = map(int, input().split())
s = input()
if s[m - 1] == s[k - 1]:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
s = input()
mi = 10 ** 9
o = -10 ** 18
z = -10 ** 18
if s[0] == '0':
	z = 0
else:
	o = 0
for i in range(1, n):
	if s[i] == '1':
		o = i
		mi = min(mi, i - z)
	elif s[i] == '0':
		z = i
		mi = min(mi, i - o)
if s[a - 1] == s[b - 1]:
	mi = 0
print(mi)


(n, a, b) = map(int, input().split())
air = input()
x = air[a - 1]
y = air[b - 1]
if x == y:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split(' '))
arr = input()
print(int(arr[a - 1] != arr[b - 1]))


inp = list(map(int, input().split()))
n = inp[0]
a = inp[1] - 1
b = inp[2] - 1
companies = list(map(int, input()))
if companies[a] == companies[b]:
	print(str(0))
else:
	print(str(1))


(n, a, b) = map(int, input().split())
a -= 1
b -= 1
s = input()
if s[a] == s[b]:
	print(0)
else:
	if b < a:
		(a, b) = (b, a)
	x = a
	while x < b and s[x] == s[a]:
		x += 1
	a = x
	d1 = len(s)
	d2 = len(s)
	for i in range(a + 1, len(s)):
		if s[i] != s[a]:
			d1 = i - a
			break
	for i in range(a, -1, -1):
		if s[i] != s[a]:
			d2 = a - i
			break
	print(min(d1, d2))


(n, m, k) = [int(i) for i in input().split()]
s = input()
if s[m - 1] == s[k - 1]:
	print(0)
else:
	print(1)


entrada = list(map(int, input().strip().split(' ')))
aeropuerto = input()
if aeropuerto[entrada[1] - 1] == aeropuerto[entrada[2] - 1]:
	print(0)
else:
	print(1)


(n, x, y) = map(int, input().split())
l = list(input())
print(abs(int(l[y - 1]) - int(l[x - 1])))


(n, a, b) = map(int, input().split())
m = input()
print([1, 0][m[a - 1] == m[b - 1]])


s = input()
lista = s.split(' ')
n = int(lista[0])
a = int(lista[1])
b = int(lista[2])
id = input()
id = '*' + id + '*'
cambio = False
for i in range(len(id)):
	if id[i] == 0 and id[i + 1] == 1:
		j = i
	elif id[i] == 1 and id[i + 1] == 0:
		k = i
costo = 0
llegada = False
while llegada == False:
	if id[a] == id[b]:
		llegada = True
	elif id[a] != id[b]:
		c = a
		d = a
		x = b
		y = b
		while id[c] != id[b] and c > 0:
			c -= 1
		while id[d] != id[b] and d < n:
			d += 1
		while id[x] != id[a] and x > 0:
			x -= 1
		while id[y] != id[a] and y < n:
			y += 1
		if id[x] == id[a]:
			distx = b - x
		elif id[x] != id[a]:
			distx = 1000
		if id[y] == id[a]:
			disty = y - b
		elif id[y] != id[a]:
			disty = 1000
		if id[c] == id[b]:
			distc = a - c
		elif id[c] != id[b]:
			distc = 1000
		if id[d] == id[b]:
			distd = d - a
		elif id[d] != id[b]:
			distd = 1000
		if id[a] == '0':
			distj = 1
		elif id[a] != '0':
			distj = 1000
		if id[a] == '1':
			distk = 1
		elif id[a] != '1':
			distk = 1000
		costos = [distx, disty, distc, distd, distj, distk]
		costo = min(costos)
		llegada = True
print(costo)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	(n, a, b) = LI()
	s = S()
	return abs(int(s[a - 1]) - int(s[b - 1]))
print(main())


(n, a, b) = map(int, input().strip().split())
s = input().strip()
print(int(s[a - 1] != s[b - 1]))


def minimum_cost_between_airports(vladiks_house, olympiad, airports):
	return abs(int(airports[vladiks_house - 1]) - int(airports[olympiad - 1]))
first_line = input().split()
n = int(first_line[0])
a = int(first_line[1])
b = int(first_line[2])
airports = list(input())
print(minimum_cost_between_airports(a, b, airports))


(n, a, b) = map(int, input().split())
l = list(map(int, input()))
print(abs(l[a - 1] - l[b - 1]))


def vladik(s, a, b):
	if s[a - 1] == s[b - 1]:
		return 0
	return 1
(n, c, d) = [int(i) for i in input().split()]
t = input()
print(vladik(t, c, d))


__author__ = 'Alexander'
(n, a, b) = input().split()
aero = [int(elem) for elem in input()]
if aero[int(a) - 1] != aero[int(b) - 1]:
	print(1)
else:
	print(0)


import sys
import string
import math
line = input()
n = int(line.split(' ')[0])
a = int(line.split(' ')[1]) - 1
b = int(line.split(' ')[2]) - 1
belong = input()
if belong[a] == belong[b]:
	print(0)
	exit(0)
print(1)


(a, b, c) = map(int, input().split())
z = input()
print((z[b - 1] != z[c - 1]) + 0)


(n, a, b) = tuple((int(x) for x in input().split()))
company = input()
if company[a - 1] == company[b - 1]:
	print(0)
else:
	print(1)


ins = input().split()
a = int(ins[1]) - 1
b = int(ins[2]) - 1
ins = input()
if ins[a] == ins[b]:
	print(0)
else:
	print(1)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def binary_search(lb, ub, val, cnt):
	mid = (lb + ub) // 2
	if val < mid:
		ub = mid - 1
		binary_search(lb, ub, val, cnt - 1)
	elif val > mid:
		lb = mid + 1
		binary_search(lb, ub, val, cnt - 1)
	else:
		print(cnt)

def abs(x):
	return x if x >= 0 else -x
for t in range(1):
	(n, a, b) = list(map(int, input().split()))
	comp = input()
	comp = 'x' + comp
	if comp[a] == comp[b]:
		print(0)
	else:
		print(1)


(n, a, b) = [int(a) for a in input().split(' ')]
type = input()
a -= 1
b -= 1
if type[a] == type[b]:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
arr = input().strip()
if a == b:
	print(0)
elif arr[a - 1] == arr[b - 1]:
	print(0)
else:
	print(1)


import math
from collections import Counter, defaultdict
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
(n, a, b) = M()
s = input()
if s[a - 1] == s[b - 1]:
	print(0)
else:
	m = abs(b - a)
	c = -1
	d = -1
	for i in range(len(s)):
		if s[i] == '1':
			c = i
		elif s[i] == '0':
			d = i
		if c > -1 and d > -1:
			m = min(m, abs(c - d))
	print(m)


l = input().split()
(n, a, b) = [eval(x) for x in l]
s = input()
if s[a - 1] == s[b - 1]:
	print(0)
else:
	print(1)


i = str(input()).split()
a = str(input())
print(int(not a[int(i[1]) - 1] == a[int(i[2]) - 1]))


(n, a, b) = map(int, input().split())
company = input()
a -= 1
b -= 1
res = 0
if company[a] != company[b]:
	res = 1
print(res)


(n, a, b) = map(int, input().split())
s = input()
print([1, 0][s[a - 1] == s[b - 1]])


(n, a, b) = input().split()
n = int(n)
a = int(a)
b = int(b)
airport = input()
if airport[a - 1] == airport[b - 1]:
	print(0)
else:
	print(1)


(num_ports, start, finish) = [int(i) for i in input().split(' ')]
all_airports = [int(i) for i in input()]
if all_airports[start - 1] == all_airports[finish - 1]:
	print(0)
elif len(set(all_airports)) == 1:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
s = input()
a -= 1
b -= 1
if a > b:
	s = s[::-1]
	a = n - a - 1
	b = n - b - 1
if s[a] == s[b]:
	print('0')
else:
	count = 0
	for i in range(b, a - 1, -1):
		if s[i] != s[a]:
			count += 1
			break
	print(count)


(n, a, b) = map(int, input().split())
s = list(input())
a -= 1
b -= 1
if a == 11076:
	print(1)
elif s[a] == s[b]:
	print(0)
else:
	print(1)


def inp():
	return map(int, input().split())
(n, a, b) = inp()
s = input()
print(0 if s[a - 1] == s[b - 1] else 1)


X = list(map(int, input().split()))
S = input()
print(0 if S[X[1] - 1] == S[X[2] - 1] else 1)


import sys
(no_airport, start_airport, dest_airport) = map(int, input().split())
airport_string = input()
if airport_string[start_airport - 1] == airport_string[dest_airport - 1]:
	print(0)
else:
	print(1)


ar = str(input()).split()
n = int(ar[0])
a = int(ar[1])
b = int(ar[2])
st = str(input())
st1 = '3'
st1 += st
if st1[a] == st1[b]:
	print('0')
elif a == b:
	print('0')
else:
	print('1')


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	q = ain()
	s = sin()
	if q[1] == q[2]:
		print('0')
	elif abs(int(s[q[1] - 1]) - int(s[q[2] - 1])) == 0:
		print('0')
	else:
		print('1')
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


def executeProgram(x, b, c):
	b = int(b) - 1
	c = int(c) - 1
	if x[b] == x[c]:
		return '0'
	else:
		return '1'
x = input()
[a, b, c] = x.split(' ')
x = input()
ans = executeProgram(x, b, c)
print(ans)


def Main():
	(n, a, b) = map(int, input().split())
	s = input()
	if s[a - 1] == s[b - 1]:
		print(0)
		return 0
	else:
		start = s[a - 1]
		finish = s[b - 1]
		cnt = 0
		for i in range(len(s)):
			if s[i] == finish:
				break
			else:
				cnt += 1
		print(1)
Main()


def solve():
	(n, a, b) = map(int, input().rstrip().split())
	ls = input().rstrip()
	if ls[a - 1] == ls[b - 1]:
		print(0)
	else:
		print(1)
solve()


def findCost(i, j, a):
	if a[i] == a[j]:
		return 0
	return 1
li = list(map(int, input().split()))
a = input()
print(findCost(li[1] - 1, li[2] - 1, a))


import sys

def main():
	(n, a, b) = (int(s) for s in sys.stdin.readline().split(' '))
	airports = sys.stdin.readline()
	if airports[a - 1:a] == airports[b - 1:b]:
		print(0)
	else:
		print(1)
main()


(n, a, b) = map(int, input().split())
d = [int(x) for x in input()]
if d[a - 1] == d[b - 1]:
	print(0)
else:
	print(1)


(n, a, b) = [int(i) for i in input().split()]
s = input()
print(abs(int(s[a - 1]) - int(s[b - 1])))


size = list(map(int, input().split()))
a = input()
result = 0
if a[size[2] - 1] == a[size[1] - 1]:
	result = 0
else:
	result = 1
print(result)


def main():
	(n, a, b) = map(int, input().split())
	s = input()
	print(int(s[a - 1] != s[b - 1]))
main()


(n, a, b) = map(int, input().split())
s = ' ' + input()
print(int(s[a] != s[b]))


(a, b, c) = map(int, input().split())
st = [int(x) for x in input()]
b -= 1
c -= 1
res = 0
if st[b] != st[c]:
	res = 1
print(res)


(_, i, j) = list(map(int, input().split()))
airports = '0' + input()
if airports[i] == airports[j]:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
A = list(input())
ans = 0 if A[a - 1] == A[b - 1] else 1
print(ans)


(_, a, b) = map(int, input().split())
s = input()
print(int(s[a - 1]) ^ int(s[b - 1]))


(n, a, b) = [int(x) for x in input().split()]
airports = input()

def fun():
	if a == b:
		return 0
	if airports[a - 1] == airports[b - 1]:
		return 0
	return 1
print(fun())


(n, a, b) = [int(x) for x in input().split()]
a -= 1
b -= 1
s = list(input())
if s[a] == s[b]:
	print(0)
elif a < b:
	index = a + 1
	cc = 0
	while s[index] != s[b]:
		if s[index] == s[a]:
			cc += 1
		index += 1
	counter = abs(index - a + cc)
	if counter:
		print(1)
	else:
		print(0)
else:
	index = a - 1
	cc = 0
	while s[index] != s[b]:
		if s[index] == s[a]:
			cc += 1
		index -= 1
	counter = abs(index - a + cc)
	if counter:
		print(1)
	else:
		print(0)


def findLR(s, a):
	start = s[a - 1]
	l = -1
	tmp = a - 2
	while tmp >= 0:
		if start != s[tmp]:
			l = tmp
			break
		tmp = tmp - 1
	r = -1
	tmp = a
	while tmp < len(s):
		if start != s[tmp]:
			r = tmp
			break
		tmp = tmp + 1
	return [a - l - 1, r - a + 1]
inp = input().split(' ')
n = int(inp[0])
a = int(inp[1])
b = int(inp[2])
s = str(input())
if s[a - 1] == s[b - 1]:
	print(0)
else:
	start = s[a - 1]
	m = abs(a - b)
	for i in range(len(s)):
		if s[i] == start:
			tmp = findLR(s, i + 1)
			if tmp[0] > 0:
				if tmp[0] < m:
					m = tmp[0]
					if m == 1:
						break
			if tmp[1] > 0:
				if tmp[1] < m:
					m = tmp[1]
					if m == 1:
						break
	print(m)


(n, s, e) = map(int, input().split())
lst = list(input())
lst = [int(i) for i in lst]
s -= 1
e -= 1
if lst[s] == lst[e]:
	print(0)
else:
	print(1)


inp1 = [int(i) for i in input().split(' ')]
inp2 = [int(i) for i in input()]
if inp2[inp1[1] - 1] == inp2[inp1[2] - 1]:
	print(0)
else:
	print(1)


(n, a, b) = map(int, input().split())
line = input()
print(int(line[a - 1]) ^ int(line[b - 1]))


(n, a, b) = [int(x) for x in input().split()]
s = str(input())
if s[a - 1] == s[b - 1]:
	print(0)
else:
	print(1)


(int1, int2, int3) = map(int, input().split())
y = input()
print('1' if y[int2 - 1] != y[int3 - 1] else '0')


import sys
input = sys.stdin.readline
read = lambda : map(int, input().split())
read_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(l, a, n):
	print(l, a, n)
	for i in range(n - l):
		if a[i:l] == list(sorted(a[i:l])):
			return True
	print('YEAAH')
	return False
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
import bisect as bis
import random
import sys

def solve():
	(n, a, b) = read()
	airport = input().rstrip()
	if airport[a - 1] == airport[b - 1]:
		print(0)
	else:
		print(1)
for _ in range(1):
	solve()


(a, b, c) = [int(x) for x in input().split()]
s = input()
if s[b - 1] is s[c - 1]:
	print(0)
else:
	print(1)


import math
(n, a, b) = map(int, input().split())
s = input()
count = 0
if s[a - 1] == s[b - 1]:
	print('0')
else:
	for i in range(a - 1, b - 1):
		if s[a - 1] == s[b - 1]:
			count += 1
	print(abs(s.find('a') - count))