#include <bits/stdc++.h>
using namespace std;
const int Q = 100008;
char a[Q], b[Q];
int n;
int compara(int p1, int p2, bool f1, bool f2) {
  if (p1 == n && f1 == 1 && f2 == 1) return 1;
  if (a[p1] == b[p2]) return compara(p1 + 1, p2 + 1, f1, f2);
  int act = 0;
  if (f1 == 0) act += compara(p1 + 1, p2, 1, f2);
  if (f2 == 0) act += compara(p1, p2 + 1, f1, 1);
  return act;
}
int main() {
  cin >> n >> a >> b;
  cout << compara(0, 0, 0, 0);
  return 0;
}
