#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 25;
long long n, x, y, dp[2][N], ans = 1e15 + 18;
char c[N];
bool chk(long long l, long long r) {
  long long X = dp[1][n] - dp[1][r] + dp[1][l - 1],
            Y = dp[0][n] - dp[0][r] + dp[0][l - 1];
  if (abs(x - X) + abs(y - Y) <= r - l + 1 &&
      (abs(x - X) + abs(y - Y) - (r - l + 1)) % 2 == 0)
    return true;
  return false;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    dp[0][i] = dp[0][i - 1];
    dp[1][i] = dp[1][i - 1];
    if (c[i] == 'U') dp[0][i]++;
    if (c[i] == 'D') dp[0][i]--;
    if (c[i] == 'L') dp[1][i]--;
    if (c[i] == 'R') dp[1][i]++;
  }
  cin >> x >> y;
  if (dp[0][n] == y && dp[1][n] == x) return cout << 0, 0;
  for (int i = 1; i <= n; i++) {
    long long b = i - 1, e = n, mid;
    while (e - b > 1) {
      mid = (e + b) / 2;
      if (chk(i, mid))
        e = mid;
      else
        b = mid;
    }
    if (chk(i, e)) ans = min(ans, e - i + 1);
  }
  cout << (ans == 1e15 + 18 ? -1 : ans);
}
