#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 7;
const long long mod = 1e9 + 7;
int n;
int a;
int b;
string s;
int main() {
  cin >> n >> a >> b;
  cin >> s;
  if (s[b - 1] == s[a - 1]) {
    cout << 0;
    return 0;
  }
  int x = 1e7, y = 1e7;
  for (int i = b - 1; i < n; i++) {
    if (s[i] == s[b - 1]) {
      x = i;
      break;
    }
  }
  for (int i = b - 1; i >= 0; i--) {
    if (s[i] == s[b - 1]) {
      y = i;
      break;
    }
  }
  if (b - x < 0) {
    cout << b - x;
  }
  if (b - y < 0) {
    cout << b - y;
  }
  cout << min(b - x, b - y);
}
