#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  a--, b--;
  string s;
  cin >> s;
  if (s[a] == s[b]) {
    cout << 0 << endl;
    return 0;
  }
  int ans = 10000000;
  int x, y;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == s[a]) {
      x = i;
      break;
    }
  }
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != s[a]) {
      y = i;
      break;
    }
  }
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != s[a]) {
      y = i;
    }
    if (s[i] == s[a]) {
      x = i;
    }
    ans = min(ans, abs(x - y));
  }
  cout << ans << endl;
  return 0;
}
