Ghost imaging with a single detector