#include <bits/stdc++.h>
const int maxn = 1000000;
using namespace std;
int n, a, b;
char s[maxn + 10];
int main() {
  scanf("%d%d%d", &n, &a, &b);
  scanf("%s", s);
  if (a > b) swap(a, b);
  if (s[a - 1] == s[b - 1]) {
    printf("0\n");
  } else {
    int ans = 0x3f3f3f3f;
    int temp = s[0];
    int temp1 = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] != temp) {
        ans = min(ans, i - temp1);
        temp = s[i];
        temp1 = i;
      } else {
        temp1 = i;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
