How to Count Numbers of Attachments

I need to count the numbers of attachments attached in the form.
is there any way?
please help.


Thank you very much @ashish-greycube its working.

@ashish-greycube can you please also tell me how to trigger this on when user attach files, currently it is working on refresh event.