Does the file only contain integers and nothing else?
The problem would become very simple then.