#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, a, b;
  cin >> n >> a >> b;
  cin >> s;
  if ((s[a - 1] == '0' && s[b - 1] == '0') ||
      (s[a - 1] == '1' && s[b - 1] == '1'))
    cout << "0" << endl;
  else
    cout << "1" << endl;
  return 0;
}
