# import bisect # Binary Search module for list # import sys # from sys import stdin, exit, setrecursionlimit # from collections import deque # from collections import Counter # from itertools import accumulate # from heapq import heappop, heappush # from atcoder.segtree import SegTree # from sortedcontainers import SortedSet, SortedList, SortedDict # input = stdin.readline def main(): N = int(input()) A, B = map(int, input().split()) P = list(map(int, input().split())) ans = -1 for i in range(N): match P[i]: case 1: A-=1 case 2: B-=1 case 3: A-=1 B-=1 if A<0 or B<0: ans = i+1 break print(ans) # ===================================== # mylib # ===================================== def get_primenumbers(mx): """ エラトステネスの篩 引数mxまでの素数をリストで返す :param mx: 探索範囲の最大値 """ prime_l = [True for _ in range(mx+1)] prime_l[0] = False prime_l[1] = False for i in range(4, mx+1, 2): prime_l[i] = False i = 3 while i**2