The present invention provides a novel compound having an antiviral activity, in particular, an HIV replication inhibiting activity, as well as a pharmaceutical composition, in particular, an anti-HIV agent.wherein ring A is substituted or unsubstituted carbocycle or substituted or unsubstituted heterocycle R1 is substituted or unsubstituted alkyl etc. R2 is substituted or unsubstituted alkyloxy etc. n is 1 or 2 R3 is substituted or unsubstituted carbocyclyl or substituted or unsubstituted heterocyclyl R4 is a hydrogen atom etc. R6 is substituted or unsubstituted alkyl etc.