#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 101000;
long long dp[N][3][3];
int n;
char s[N], t[N];
void upd(int x, int a, int b, long long c) {
  if (a >= 2 || b >= 2) return;
  dp[x][a][b] += c;
}
int main() {
  scanf("%d", &n);
  scanf("%s%s", s, t);
  dp[0][0][0] = 1;
  for (int i = 0; i < n + 1; i++)
    for (int j = 'a'; j < 'z' + 1; j++)
      for (int p1 = 0; p1 < 2; p1++)
        for (int p2 = 0; p2 < 2; p2++)
          if (dp[i][p1][p2]) {
            upd(i + 1, p1 + (j != s[i - p1]), p2 + (j != t[i - p2]),
                dp[i][p1][p2]);
          }
  printf("%I64d\n", dp[n + 1][1][1]);
}
