#include <bits/stdc++.h>
using namespace std;
pair<int, int> p[500007], x[500007];
int kq = 500007, n, cx, cy;
char second[500007];
bool thoaman(int k) {
  bool kqc = 0;
  for (int i = 0; i <= n; i++) {
    int j = i + k + 1;
    if (j > n + 1) continue;
    int t1 = abs(cx - (x[i].first + p[j].first));
    int t2 = abs(cy - (x[i].second + p[j].second));
    if (t1 + t2 <= k && (t1 + t2 - k) % 2 == 0) kqc = 1;
  }
  return kqc;
}
int main() {
  scanf("%d", &n);
  cin >> second + 1;
  scanf("%d%d", &cx, &cy);
  for (int i = n; i >= 1; i--) {
    p[i] = p[i + 1];
    if (second[i] == 'R') p[i].first++;
    if (second[i] == 'L') p[i].first--;
    if (second[i] == 'U') p[i].second++;
    if (second[i] == 'D') p[i].second--;
  }
  for (int i = 1; i <= n; i++) {
    x[i] = x[i - 1];
    if (second[i] == 'R') x[i].first++;
    if (second[i] == 'L') x[i].first--;
    if (second[i] == 'U') x[i].second++;
    if (second[i] == 'D') x[i].second--;
  }
  int l = 0, r = n;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (thoaman(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (!thoaman(l)) l++;
  if (!thoaman(l)) l++;
  if (l > n)
    cout << -1;
  else
    cout << l;
}
