#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  const int base = 'z' - 'a' + 1;
  int n, search[base], inStrS[base][base + 1], finish = 0, i = 0, ansI = -1,
                                               ansJ = -1, match = 0;
  memset(search, -1, base * sizeof(int));
  memset(inStrS, -1, base * (base + 1) * sizeof(int));
  string s, t;
  cin >> n;
  cin >> s >> t;
  while (i < n) {
    if (s[i] != t[i] && finish != 2) {
      if (inStrS[t[i] - 'a'][0] != -1) {
        if (inStrS[t[i] - 'a'][s[i] - 'a' + 1] != -1) {
          ansI = inStrS[t[i] - 'a'][s[i] - 'a' + 1] + 1;
          ansJ = i + 1;
          finish = 2;
        } else {
          ansI = inStrS[t[i] - 'a'][0] + 1;
          ansJ = i + 1;
          finish = 1;
        }
      } else if (search[s[i] - 'a'] != -1) {
        ansI = search[s[i] - 'a'] + 1;
        ansJ = i + 1;
        if (t[i] == s[ansI - 1])
          finish = 2;
        else
          finish = 1;
      }
      inStrS[s[i] - 'a'][0] = i;
      inStrS[s[i] - 'a'][t[i] - 'a' + 1] = i;
      search[t[i] - 'a'] = i;
    } else if (s[i] == t[i])
      ++match;
    ++i;
  }
  cout << n - (match + finish) << endl << ansI << " " << ansJ;
}
