#include <bits/stdc++.h>
using namespace std;
char airport[100005];
int main() {
  int n, a, b;
  scanf("%d %d %d", &n, &a, &b);
  a--;
  b--;
  cin >> airport;
  if (airport[a] == airport[b]) {
    printf("0\n");
  } else {
    int ans = n;
    int loc[2] = {-1000000, -1000000};
    for (int i = 0; i < n; i++) {
      int tmp = '1' - airport[i];
      loc[tmp] = i;
      ans = min(ans, loc[tmp] - loc[1 - tmp]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
