#include <bits/stdc++.h>
using namespace std;
bool Check(long);
vector<pair<long, long> > A;
long N;
string S;
pair<long, long> EN;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long L, R, M, Answer = -1;
  cin >> N;
  cin.clear();
  cin.ignore(32767, '\n');
  getline(cin, S);
  S = '$' + S + '$';
  cin >> EN.first >> EN.second;
  A.assign(N + 2, {0, 0});
  for (long i = 1; i <= N; ++i) {
    A[i].first += A[i - 1].first + (S[i] == 'R') - (S[i] == 'L');
    A[i].second += A[i - 1].second + (S[i] == 'U') - (S[i] == 'D');
  }
  L = 1;
  R = N;
  while (L <= R) {
    M = (L + R) >> 1;
    if (Check(M)) {
      Answer = M;
      R = M - 1;
    } else
      L = M + 1;
  }
  if (N < abs(EN.first) + abs(EN.second) ||
      (N - abs(EN.first) - abs(EN.second)) % 2 != 0)
    Answer = -1;
  if (A[N] == EN) Answer = 0;
  cout << Answer << endl;
  return 0;
}
bool Check(long L) {
  for (long i = L; i <= N; ++i)
    if (abs(EN.first - A[N].first + A[i].first - A[i - L].first) +
            abs(EN.second - A[N].second + A[i].second - A[i - L].second) <=
        L)
      return true;
  return false;
}
