How to put number counter?

How to put number counter?

I want to create a form for registration. I have to create a student ID which can not be duplicate.
How do I create an ID that is a number and is in counter. The new form should just add up 1 to give a new ID.