#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  char c[n + 1];
  for (long long i = 1; i <= n; i++) cin >> c[i];
  long long x, y;
  cin >> x >> y;
  pair<long long, long long> prefix[n + 1], suffix[n + 2];
  prefix[0] = {0, 0};
  suffix[n + 1] = {0, 0};
  {
    long long curx = 0, cury = 0;
    for (long long i = 1; i <= n; i++) {
      switch (c[i]) {
        case 'L':
          curx--;
          break;
        case 'R':
          curx++;
          break;
        case 'U':
          cury++;
          break;
        case 'D':
          cury--;
          break;
      }
      prefix[i] = {curx, cury};
    }
    if (curx == x && cury == y) {
      cout << 0;
      return 0;
    }
  }
  {
    long long curx = 0, cury = 0;
    for (long long i = n; i >= 1; i--) {
      switch (c[i]) {
        case 'L':
          curx--;
          break;
        case 'R':
          curx++;
          break;
        case 'U':
          cury++;
          break;
        case 'D':
          cury--;
          break;
      }
      suffix[i] = {curx, cury};
    }
  }
  auto canChange = [&](long long length) {
    for (long long i = 1; i + length - 1 <= n; i++) {
      long long curx = x - prefix[i - 1].first - suffix[i + length].first;
      long long cury = y - prefix[i - 1].second - suffix[i + length].second;
      long long step = abs(curx) + abs(cury);
      if (step <= length && (length - step) % 2 == 0) return true;
    }
    return false;
  };
  if (!canChange(n)) {
    cout << -1;
    return 0;
  }
  long long l = 1, r = n;
  while (l < r) {
    long long mid = (l + r) / 2;
    if (canChange(mid))
      r = mid;
    else
      l = mid + 1;
  }
  cout << l;
}
