#include <bits/stdc++.h>
using namespace std;
void fast_io() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
const long long MAXN = 2e5 + 228;
pair<long long, long long> pref[MAXN];
pair<long long, long long> suf[MAXN];
signed main() {
  fast_io();
  long long n;
  cin >> n;
  string s;
  cin >> s;
  for (long long i = 0; i < (long long)(s.size()); i++) {
    pair<long long, long long> p =
        (i == 0 ? make_pair((long long)0, (long long)0) : pref[i - 1]);
    if (s[i] == 'L') {
      p.first--;
    }
    if (s[i] == 'R') {
      p.first++;
    }
    if (s[i] == 'U') {
      p.second++;
    }
    if (s[i] == 'D') {
      p.second--;
    }
    pref[i] = p;
  }
  for (long long i = (long long)(s.size()) - 1; i >= 0; i--) {
    pair<long long, long long> p =
        (i == n - 1 ? make_pair((long long)0, (long long)0) : suf[i + 1]);
    if (s[i] == 'L') {
      p.first--;
    }
    if (s[i] == 'R') {
      p.first++;
    }
    if (s[i] == 'U') {
      p.second++;
    }
    if (s[i] == 'D') {
      p.second--;
    }
    suf[i] = p;
  }
  long long x, y, ans = 1e18;
  cin >> x >> y;
  if (!((long long)(s.size()) >= abs(x) + abs(y) &&
        (long long)(s.size()) % 2 == (abs(x) + abs(y)) % 2)) {
    cout << -1;
    return 0;
  }
  for (long long i = -1; i < n; i++) {
    long long l = i, r = n;
    while (r - l > 1) {
      long long m = (l + r) / 2;
      pair<long long, long long> p =
          (i == -1 ? make_pair((long long)0, (long long)0) : pref[i]);
      long long delta_x = p.first + suf[m].first,
                delta_y = p.second + suf[m].second;
      if (m - i - 1 >= abs(delta_x - x) + abs(delta_y - y)) {
        r = m;
      } else {
        l = m;
      }
    }
    if (r == n) {
      pair<long long, long long> p =
          (i == -1 ? make_pair((long long)0, (long long)0) : pref[i]);
      if (n - i - 1 >= abs(p.first - x) + abs(p.second - y)) {
        ans = min(ans, r - i - 1);
      }
    } else {
      ans = min(ans, r - i - 1);
    }
  }
  cout << ans;
  return 0;
}
