Ezra 2 is a preliminary head count, while Nehemiah 7 (written 10 years later) is an official register.