#include <bits/stdc++.h>
int max(int a, int b) {
  if (a >= b) {
    return a;
  } else
    return b;
}
int min(int a, int b) {
  if (a <= b) {
    return a;
  } else
    return b;
}
int main() {
  int n, i, x, y, cnt = 0;
  scanf("%d", &n);
  char s1[n], s2[n];
  scanf("%s", s1);
  scanf("%s", s2);
  for (i = 0; i < n; i++) {
    x = max(s1[i], s2[i]);
    y = min(s1[i], s2[i]);
    if (x - y <= 5) {
      cnt += x - y;
    } else
      cnt += 56 - x + y - 47 + 1;
  }
  printf("%d\n", cnt);
  return 0;
}
