<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def number_of_singleton_referents(self):
 """ Returns the number of singleton elements of the referential domain that are compatible with the current belief state. This is the size of the union of all referent sets. """

        if self.__dict__['referential_domain']:
            ct = 0
            for i in self.iter_singleton_referents():
                ct += 1
            return ct
        else:
            raise Exception("self.referential_domain must be defined")