#include <bits/stdc++.h>
using namespace std;
pair<int, int> conv(char c) {
  if (c == 'R') {
    return {1, 0};
  } else if (c == 'L') {
    return {-1, 0};
  } else if (c == 'U') {
    return {0, 1};
  } else {
    return {0, -1};
  }
}
pair<int, int> operator+(pair<int, int> a, pair<int, int> b) {
  a.first += b.first;
  a.second += b.second;
  return a;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int x, y;
  cin >> x >> y;
  if (abs(x) + abs(y) > (int)(s).size() ||
      (abs(x) + abs(y)) % 2 != (int)(s).size() % 2) {
    cout << "-1\n";
    return 0;
  }
  vector<pair<int, int> > suff(n + 1);
  suff[n] = {0, 0};
  suff[n - 1] = conv(s[n - 1]);
  for (int i = n - 2; i >= 0; --i) {
    suff[i] = conv(s[i]) + suff[i + 1];
  }
  int ans = n;
  pair<int, int> start = {0, 0};
  for (int i = 0; i <= n; ++i) {
    int dx = x - start.first, dy = y - start.second;
    int rem = n - i;
    if (abs(dx) + abs(dy) <= rem) {
      int lf = i - 1, rg = n;
      while (rg - lf > 1) {
        int md = (lf + rg) >> 1;
        int a = x - start.first - suff[md].first;
        int b = y - start.second - suff[md].second;
        if (abs(a) + abs(b) > md - i) {
          lf = md;
        } else {
          rg = md;
        }
      }
      int a = x - start.first - suff[rg].first;
      int b = y - start.second - suff[rg].second;
      if (abs(a) + abs(b) <= rg - i) {
        ans = min(ans, rg - i);
      }
    }
    start = start + conv(s[i]);
  }
  cout << ans << "\n";
}
