-
Notifications
You must be signed in to change notification settings - Fork 0
/
CF165A.java
53 lines (46 loc) · 1.38 KB
/
CF165A.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import java.util.Scanner;
public class CF165A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] xn = new int[n];
int[] yn = new int[n];
int ans = 0;
for(int i = 0; i < n; i++) {
xn[i] = sc.nextInt();
yn[i] = sc.nextInt();
}
for(int i = 0; i < n; i++) {
int x = xn[i];
int y = yn[i];
boolean left = false;
boolean right = false;
boolean top = false;
boolean bottom = false;
for(int j = 0; j < n; j++) {
if(i != j) {
int x1 = xn[j];
int y1 = yn[j];
if(x == x1 && y < y1) {
top = true;
}
if(x == x1 && y > y1) {
bottom = true;
}
if(y == y1 && x < x1) {
right = true;
}
if(y == y1 && x > x1) {
left = true;
}
if(top && bottom && left && right) {
ans++;
break;
}
}
}
}
System.out.println(ans);
sc.close();
}
}