#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
const int mod = 1000000007;
const long double eps = 1e-9;
mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());
bool check(string s, string t) {
  for (int i = 0; i < t.size(); ++i) {
    if (s[i] != t[i]) {
      s.erase(s.begin() + i);
      return s == t;
    }
  }
  return true;
}
void solve() {
  int n;
  scanf("%d", &n);
  string s, t;
  cin >> s >> t;
  if (s == t) {
    printf("%d\n", 25 * n + 26);
    return;
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] != t[i]) {
      ans += check(s.substr(0, i) + t[i] + s.substr(i), t);
      ans += check(t.substr(0, i) + s[i] + t.substr(i), s);
      break;
    }
  }
  printf("%d\n", ans);
}
int main() {
  solve();
  return 0;
}
