#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int n, lx[maxn], ly[maxn], rx[maxn], ry[maxn], ans;
char a[maxn];
int dis(int x, int y, int xx, int yy) { return abs(x - xx) + abs(y - yy); }
int main() {
  int i, j;
  cin >> n;
  cin >> a + 1;
  cin >> rx[n + 1] >> ry[n + 1];
  lx[0] = 0;
  ly[0] = 0;
  for (i = 1; i <= n; i++) {
    lx[i] = lx[i - 1];
    ly[i] = ly[i - 1];
    if (a[i] == 'U') ly[i]++;
    if (a[i] == 'D') ly[i]--;
    if (a[i] == 'L') lx[i]--;
    if (a[i] == 'R') lx[i]++;
  }
  for (i = n; i >= 1; i--) {
    rx[i] = rx[i + 1];
    ry[i] = ry[i + 1];
    if (a[i] == 'U') ry[i]--;
    if (a[i] == 'D') ry[i]++;
    if (a[i] == 'L') rx[i]++;
    if (a[i] == 'R') rx[i]--;
  }
  if ((abs(rx[n + 1]) + abs(ry[n + 1])) > n ||
      (n - abs(rx[n + 1]) - abs(ry[n + 1])) % 2) {
    cout << "-1\n";
    return 0;
  }
  ans = n;
  j = 1;
  for (i = 0; i <= n; i++) {
    for (j = max(j, i + 1); j <= n + 1; j++)
      if (dis(lx[i], ly[i], rx[j], ry[j]) <= j - i - 1) break;
    if (j > n + 1) break;
    ans = min(ans, j - i - 1);
  }
  cout << ans << "\n";
  return 0;
}
