#include <bits/stdc++.h>
using namespace std;
int main() {
  int digits, flag = 0;
  cin >> digits;
  string s1, s2;
  cin >> s1 >> s2;
  for (int i = 0; i < digits; i++) {
    int temp = 0;
    temp = abs(int(s1[i]) - int(s2[i]));
    if (temp == 6) temp = 4;
    if (temp == 7) temp = 3;
    if (temp == 8) temp = 2;
    if (temp == 9) temp = 1;
    flag = flag + temp;
  }
  cout << flag;
  return 0;
}
