A heterocyclic compound of formula (I) or a salt thereof:wherein R1 is an optionally protected amino group or an optionally substituted C1-6 alkyl group R2 and R3 are each independently a C1-2 alkyl group X is a hydrogen atom or a halogen atom Z1 is N or C—R4 Z2 is N or C—R5 Z3 is N or C—R6 Z4 is N or C—R7 R4, R5, R6, and R7 are each independently a hydrogen atom, a halogen atom, an optionally protected amino group, or a C1-6 alkylsulfonyl group Z is CH or N and A is a methylene group or a bond, which has an excellent anti-HIV activity and is useful as an anti-HIV agent.