| 208 | } |
| 209 | |
| 210 | public static void main(String[] args) throws IOException { |
| 211 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); |
| 212 | StreamTokenizer in = new StreamTokenizer(br); |
| 213 | PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); |
| 214 | in.nextToken(); |
| 215 | int n = (int) in.nval; |
| 216 | in.nextToken(); |
| 217 | int m = (int) in.nval; |
| 218 | for (int i = 1, num; i <= n; i++) { |
| 219 | in.nextToken(); |
| 220 | num = (int) in.nval; |
| 221 | add(num); |
| 222 | } |
| 223 | int lastAns = 0; |
| 224 | int ans = 0; |
| 225 | for (int i = 1, op, x; i <= m; i++) { |
| 226 | in.nextToken(); |
| 227 | op = (int) in.nval; |
| 228 | in.nextToken(); |
| 229 | x = (int) in.nval ^ lastAns; |
| 230 | if (op == 1) { |
| 231 | add(x); |
| 232 | } else if (op == 2) { |
| 233 | remove(x); |
| 234 | } else if (op == 3) { |
| 235 | lastAns = rank(x); |
| 236 | ans ^= lastAns; |
| 237 | } else if (op == 4) { |
| 238 | lastAns = index(x); |
| 239 | ans ^= lastAns; |
| 240 | } else if (op == 5) { |
| 241 | lastAns = pre(x); |
| 242 | ans ^= lastAns; |
| 243 | } else { |
| 244 | lastAns = post(x); |
| 245 | ans ^= lastAns; |
| 246 | } |
| 247 | } |
| 248 | out.println(ans); |
| 249 | out.flush(); |
| 250 | out.close(); |
| 251 | br.close(); |
| 252 | } |
| 253 | |
| 254 | } |