import java.util.*;
class InstanciaDe {
public static void main
( String[] args
) { int contaF = 0;
int contaJ = 0;
ContaF Rafael = new ContaF();
ContaJ Roberto = new ContaJ();
ContaJ Carlos = new ContaJ();
ArrayList<Conta> lista = new ArrayList<Conta>();
lista.add(Rafael);
lista.add(Roberto);
lista.add(Carlos);
for(int i = 0 ; i < lista.size() ; i++) {
if (lista.get(i) instanceof ContaF) {
contaF++;
}
if (lista.get(i) instanceof ContaJ) {
contaJ++;
}
}
}
}
class Conta {}
class ContaF extends Conta {}
class ContaJ extends Conta {}
aW1wb3J0IGphdmEudXRpbC4qOwoKY2xhc3MgSW5zdGFuY2lhRGUgewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4oIFN0cmluZ1tdIGFyZ3MgKSB7CgkJaW50IGNvbnRhRiA9IDA7CgkJaW50IGNvbnRhSiA9IDA7CgkgICAgQ29udGFGIFJhZmFlbCA9IG5ldyBDb250YUYoKTsKCSAgICBDb250YUogUm9iZXJ0byA9IG5ldyBDb250YUooKTsKCSAgICBDb250YUogQ2FybG9zID0gbmV3IENvbnRhSigpOwoJICAgIEFycmF5TGlzdDxDb250YT4gbGlzdGEgPSBuZXcgQXJyYXlMaXN0PENvbnRhPigpOyAgICAgICAgCgkgICAgbGlzdGEuYWRkKFJhZmFlbCk7CgkgICAgbGlzdGEuYWRkKFJvYmVydG8pOwoJICAgIGxpc3RhLmFkZChDYXJsb3MpOwoJICAgIGZvcihpbnQgaSA9IDAgOyBpIDwgbGlzdGEuc2l6ZSgpIDsgaSsrKSB7CgkgICAgICAgIGlmIChsaXN0YS5nZXQoaSkgaW5zdGFuY2VvZiBDb250YUYpIHsKCSAgICAgICAgICAgIGNvbnRhRisrOwoJICAgICAgICB9ICAgICAgIAoJICAgICAgICBpZiAobGlzdGEuZ2V0KGkpIGluc3RhbmNlb2YgQ29udGFKKSB7CgkgICAgICAgICAgICBjb250YUorKzsKCSAgICAgICAgfQoJICAgIH0KCSAgICBTeXN0ZW0ub3V0LnByaW50bG4oY29udGFGKTsKCSAgICBTeXN0ZW0ub3V0LnByaW50bG4oY29udGFKKTsKCX0KfQpjbGFzcyBDb250YSB7fQpjbGFzcyBDb250YUYgZXh0ZW5kcyBDb250YSB7fQpjbGFzcyBDb250YUogZXh0ZW5kcyBDb250YSB7fQ==