import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; //本题,测试输入的第一行,多了一个空格,与提交后的输入数据,格式不同 public class Main { public static void main(String[] args) throws IOException { BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); String line; while((line=reader.readLine())!=null) { String[] lines=line.split(" "); int n=Integer.valueOf(lines[0]); int[] books=new int[n]; for(int i=0;i<n;i++) { books[i]=Integer.valueOf(reader.readLine()); } countFriend(n, books); } reader.close(); } //用两个数组,两重for循环,得到相同编号书籍的读者数目 private static void countFriend(int n,int[] books) { int[] count=new int[n]; for(int i=0;i<n;i++) { int num=books[i]; for(int j=0;j<n;j++) { if(num==books[j]) { count[i]++; } } } for(int i=0;i<n;i++) { if(count[i]==1){ System.out.println("BeiJu"); }else { System.out.println(count[i]-1); } } } }