<>;$t=<>;$%+=$t=~s/$_//for<>=~/./g;print$%