#include <bits/stdc++.h>   using namespace std;   int const N = 2e5 + 5;   int a[N];   int n, ac, b;   int main() {     cin >> n >> b >> ac;     int temp1 = b;     int temp2 = ac;     for (int i = 0; i < n; i++) cin >> a[i];     int i;     for (i = 0; i < n; i++) {       if (temp1 == 0 && temp2 == 0) break;       if (a[i] && temp1 && temp2 != ac) {         temp1--;         temp2++;       } else {         if (temp2 > 0)           temp2--;         else if (temp1 > 0)           temp1--;       }     }     cout << i << endl;   }   