#include <bits/stdc++.h>
using namespace std;
int isThere[400][400];
int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s;
  cin >> t;
  int dist = 0;
  memset(isThere, 0, sizeof(isThere));
  int ans10 = -1, ans11 = -1;
  int ans20 = -1, ans21 = -1;
  int newDist2 = dist;
  int newDist = dist;
  char x, y;
  bool one, two;
  one = false;
  two = false;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == t[i]) continue;
    x = s[i];
    y = t[i];
    dist++;
    if (two) continue;
    if (isThere[y][x]) {
      ans20 = i + 1;
      ans21 = isThere[y][x];
      one = true;
      two = true;
      continue;
    }
    if (one) {
      isThere[x][y] = i + 1;
      continue;
    }
    for (int j = 'a'; j <= 'z'; j++) {
      if (isThere[y][j]) {
        ans10 = i + 1;
        ans11 = isThere[y][j];
        one = true;
        break;
      } else if (isThere[j][x]) {
        ans10 = i + 1;
        ans11 = isThere[j][x];
        one = true;
        break;
      }
    }
    isThere[x][y] = i + 1;
  }
  if (two) {
    printf("%d\n", dist - 2);
    printf("%d %d\n", ans20, ans21);
  } else if (one) {
    printf("%d\n", dist - 1);
    printf("%d %d\n", ans10, ans11);
  } else {
    printf("%d\n", dist);
    printf("-1 -1\n");
  }
  return 0;
}
