Simple key signature detection algorithm for MIDI import

Works surprisingly well on the most of MIDI files. Correct accidentals - more clean resulting score.