#include <bits/stdc++.h>
int in() {
  int r = 0, c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') return -in();
  for (; c > 32; r = (r << 1) + (r << 3) + c - '0', c = getchar())
    ;
  return r;
}
using namespace std;
int n, x, y, hisx[200005], hisy[200005];
bool can(int pos) {
  for (int i = 0; i <= n - pos; i++) {
    int xx = hisx[n] - (hisx[i + pos] - hisx[i]);
    int yy = hisy[n] - (hisy[i + pos] - hisy[i]);
    if (abs(x - xx) + abs(y - yy) <= pos) return true;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  string second;
  cin >> second;
  hisx[0] = hisy[0] = 0;
  for (int i = 1; i <= n; i++) {
    hisy[i] = hisy[i - 1];
    hisx[i] = hisx[i - 1];
    if (second[i - 1] == 'U') hisy[i]++;
    if (second[i - 1] == 'D') hisy[i]--;
    if (second[i - 1] == 'R') hisx[i]++;
    if (second[i - 1] == 'L') hisx[i]--;
  }
  cin >> x >> y;
  if (x == hisx[n] && y == hisy[n]) {
    cout << 0;
    return 0;
  }
  if (abs(x + y) % 2 != n % 2 || !can(n))
    cout << -1;
  else {
    int lo = 1, hi = n, res = 0, mid;
    while (lo <= hi) {
      mid = (lo + hi) / 2;
      if (can(mid)) {
        res = mid;
        hi = mid - 1;
      } else
        lo = mid + 1;
    }
    cout << res;
  }
  return 0;
}
