165A.md (2004B)
1 Source: https://codeforces.com/problemset/problem/165/A 2 3 A. Supercentral Point 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 One day Vasya painted a Cartesian coordinate system on a piece of paper and marked some set of points (*x*1, *y*1), (*x*2, *y*2), ..., (*x**n*, *y**n*). Let's define neighbors for some fixed point from the given set (*x*, *y*): 22 23 * point (*x*', *y*') is (*x*, *y*)'s right neighbor, if *x*' > *x* and *y*' = *y* 24 * point (*x*', *y*') is (*x*, *y*)'s left neighbor, if *x*' < *x* and *y*' = *y* 25 * point (*x*', *y*') is (*x*, *y*)'s lower neighbor, if *x*' = *x* and *y*' < *y* 26 * point (*x*', *y*') is (*x*, *y*)'s upper neighbor, if *x*' = *x* and *y*' > *y* 27 28 We'll consider point (*x*, *y*) from the given set supercentral, if it has at least one upper, at least one lower, at least one left and at least one right neighbor among this set's points. 29 30 Vasya marked quite many points on the paper. Analyzing the picture manually is rather a challenge, so Vasya asked you to help him. Your task is to find the number of supercentral points in the given set. 31 32 Input 33 34 The first input line contains the only integer *n* (1 ≤ *n* ≤ 200) — the number of points in the given set. Next *n* lines contain the coordinates of the points written as "*x* *y*" (without the quotes) (|*x*|, |*y*| ≤ 1000), all coordinates are integers. The numbers in the line are separated by exactly one space. It is guaranteed that all points are different. 35 36 Output 37 38 Print the only number — the number of supercentral points of the given set. 39 40 Examples 41 42 Input 43 44 ``` 45 8 46 1 1 47 4 2 48 3 1 49 1 2 50 0 2 51 0 1 52 1 0 53 1 3 54 ``` 55 56 Output 57 58 ``` 59 2 60 ``` 61 62 Input 63 64 ``` 65 5 66 0 0 67 0 1 68 1 0 69 0 -1 70 -1 0 71 ``` 72 73 Output 74 75 ``` 76 1 77 ``` 78 79 Note 80 81 In the first sample the supercentral points are only points (1, 1) and (1, 2). 82 83 In the second sample there is one supercental point — point (0, 0).