{"problem":{"name":"A. Bank Robbery","description":{"content":"A robber has attempted to rob a bank but failed to complete his task. However, he had managed to open all the safes. Oleg the bank client loves money (who doesn't), and decides to take advantage of t","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF794A"},"statements":[{"statement_type":"Markdown","content":"A robber has attempted to rob a bank but failed to complete his task. However, he had managed to open all the safes.\n\nOleg the bank client loves money (who doesn't), and decides to take advantage of this failed robbery and steal some money from the safes. There are many safes arranged in a line, where the _i_\\-th safe from the left is called safe _i_. There are _n_ banknotes left in all the safes in total. The _i_\\-th banknote is in safe _x__i_. Oleg is now at safe _a_. There are two security guards, one of which guards the safe _b_ such that _b_ < _a_, i.e. the first guard is to the left of Oleg. The other guard guards the safe _c_ so that _c_ > _a_, i.e. he is to the right of Oleg.\n\nThe two guards are very lazy, so they do not move. In every second, Oleg can either take all the banknotes from the current safe or move to any of the neighboring safes. However, he cannot visit any safe that is guarded by security guards at any time, becaues he might be charged for stealing. Determine the maximum amount of banknotes Oleg can gather.\n\n## Input\n\nThe first line of input contains three space-separated integers, _a_, _b_ and _c_ (1 ≤ _b_ < _a_ < _c_ ≤ 109), denoting the positions of Oleg, the first security guard and the second security guard, respectively.\n\nThe next line of input contains a single integer _n_ (1 ≤ _n_ ≤ 105), denoting the number of banknotes.\n\nThe next line of input contains _n_ space-separated integers _x_1, _x_2, ..., _x__n_ (1 ≤ _x__i_ ≤ 109), denoting that the _i_\\-th banknote is located in the _x__i_\\-th safe. Note that _x__i_ are **not** guaranteed to be distinct.\n\n## Output\n\nOutput a single integer: the maximum number of banknotes Oleg can take.\n\n[samples]\n\n## Note\n\nIn the first example Oleg can take the banknotes in positions 4, 5, 6 (note that there are 2 banknotes at position 5). Oleg can't take the banknotes in safes 7 and 8 because he can't run into the second security guard. Similarly, Oleg cannot take the banknotes at positions 3 and 2 because he can't run into the first security guard. Thus, he can take a maximum of 4 banknotes.\n\nFor the second sample, Oleg can't take any banknotes without bumping into any of the security guards.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"一位劫匪试图抢劫银行，但未能完成任务。然而，他已经打开了所有保险箱。\n\n银行客户 Oleg 热爱金钱（谁不爱呢），决定利用这次失败的抢劫，从保险箱中偷走一些钱。许多保险箱排成一行，从左数第 #cf_span[i] 个保险箱称为保险箱 #cf_span[i]。所有保险箱中总共剩下 #cf_span[n] 张钞票。第 #cf_span[i] 张钞票位于保险箱 #cf_span[xi] 中。Oleg 目前位于保险箱 #cf_span[a]。有两名保安，其中一名守卫保险箱 #cf_span[b]，满足 #cf_span[b < a]，即第一位保安在 Oleg 的左侧；另一名守卫保险箱 #cf_span[c]，满足 #cf_span[c > a]，即他在 Oleg 的右侧。\n\n两名保安都非常懒惰，因此不会移动。每一秒，Oleg 可以选择拿走当前保险箱中的所有钞票，或者移动到任意一个相邻的保险箱。然而，他任何时候都不能进入被保安守卫的保险箱，否则可能被指控盗窃。请确定 Oleg 能够收集到的最大钞票数量。\n\n输入的第一行包含三个用空格分隔的整数 #cf_span[a], #cf_span[b] 和 #cf_span[c]（#cf_span[1 ≤ b < a < c ≤ 10^9]），分别表示 Oleg、第一位保安和第二位保安的位置。\n\n第二行包含一个整数 #cf_span[n]（#cf_span[1 ≤ n ≤ 10^5]），表示钞票的数量。\n\n第三行包含 #cf_span[n] 个用空格分隔的整数 #cf_span[x1, x2, ..., xn]（#cf_span[1 ≤ xi ≤ 10^9]），表示第 #cf_span[i] 张钞票位于第 #cf_span[xi] 个保险箱中。注意，#cf_span[xi] 不保证互不相同。\n\n请输出一个整数：Oleg 能够拿走的最大钞票数量。\n\n在第一个例子中，Oleg 可以拿走位置 #cf_span[4]、#cf_span[5]、#cf_span[6] 上的钞票（注意位置 #cf_span[5] 上有 #cf_span[2] 张钞票）。Oleg 无法拿走保险箱 #cf_span[7] 和 #cf_span[8] 中的钞票，因为他不能进入第二位保安守卫的区域。同样，Oleg 也无法拿走位置 #cf_span[3] 和 #cf_span[2] 上的钞票，因为他不能进入第一位保安守卫的区域。因此，他最多能拿走 #cf_span[4] 张钞票。\n\n对于第二个样例，Oleg 无法在不撞上任何保安的情况下拿走任何钞票。\n\n## Input\n\n输入的第一行包含三个用空格分隔的整数 #cf_span[a], #cf_span[b] 和 #cf_span[c]（#cf_span[1 ≤ b < a < c ≤ 10^9]），分别表示 Oleg、第一位保安和第二位保安的位置。第二行包含一个整数 #cf_span[n]（#cf_span[1 ≤ n ≤ 10^5]），表示钞票的数量。第三行包含 #cf_span[n] 个用空格分隔的整数 #cf_span[x1, x2, ..., xn]（#cf_span[1 ≤ xi ≤ 10^9]），表示第 #cf_span[i] 张钞票位于第 #cf_span[xi] 个保险箱中。注意，#cf_span[xi] 不保证互不相同。\n\n## Output\n\n请输出一个整数：Oleg 能够拿走的最大钞票数量。\n\n[samples]\n\n## Note\n\n在第一个例子中，Oleg 可以拿走位置 #cf_span[4]、#cf_span[5]、#cf_span[6] 上的钞票（注意位置 #cf_span[5] 上有 #cf_span[2] 张钞票）。Oleg 无法拿走保险箱 #cf_span[7] 和 #cf_span[8] 中的钞票，因为他不能进入第二位保安守卫的区域。同样，Oleg 也无法拿走位置 #cf_span[3] 和 #cf_span[2] 上的钞票，因为他不能进入第一位保安守卫的区域。因此，他最多能拿走 #cf_span[4] 张钞票。对于第二个样例，Oleg 无法在不撞上任何保安的情况下拿走任何钞票。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ a, b, c \\in \\mathbb{Z} $ denote the positions of Oleg, the left guard, and the right guard, respectively, with $ 1 \\leq b < a < c \\leq 10^9 $.  \nLet $ n \\in \\mathbb{Z} $ denote the number of banknotes.  \nLet $ X = (x_1, x_2, \\dots, x_n) $ be a sequence of integers where $ x_i \\in [1, 10^9] $ denotes the safe position containing the $ i $-th banknote.\n\n**Constraints**  \n1. $ 1 \\leq b < a < c \\leq 10^9 $  \n2. $ 1 \\leq n \\leq 10^5 $  \n3. $ 1 \\leq x_i \\leq 10^9 $ for all $ i \\in \\{1, \\dots, n\\} $\n\n**Objective**  \nCompute the maximum number of banknotes Oleg can collect, where he starts at position $ a $, cannot visit any safe $ \\leq b $ or $ \\geq c $, and can move to adjacent safes or collect all banknotes at his current safe in one second.  \nThat is, count the number of banknotes located in safes strictly between $ b $ and $ c $:  \n$$\n\\sum_{i=1}^{n} \\mathbf{1}_{b < x_i < c}\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF794A","tags":["brute force","implementation"],"sample_group":[["5 3 7\n8\n4 7 5 5 3 6 2 8","4"],["6 5 7\n5\n1 5 7 92 3","0"]],"created_at":"2026-03-03 11:00:39"}}