#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long Inf = 1e18;
const int N = 1e5 + 10;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
template <typename T>
void chkmax(T &a, T b) {
  a < b ? a = b : 0;
};
template <typename T>
void chkmin(T &a, T b) {
  a > b ? a = b : 0;
};
int n, cnt[N][2], cnt2[N][2];
long long ans = 0;
char a[N], b[N];
int main() {
  cin >> n;
  scanf("%s", a + 1);
  scanf("%s", b + 1);
  for (int i = n; i; i--) {
    cnt[i][0] = cnt[i + 1][0];
    cnt[i][1] = cnt[i + 1][1];
    cnt[i][a[i] - '0']++;
  }
  for (int i = 1; i <= n; i++) {
    cnt2[i][0] = cnt2[i - 1][0];
    cnt2[i][1] = cnt2[i - 1][1];
    if (b[i] == '1') cnt2[i][a[i] - '0']++;
  }
  for (int i = 1; i <= n; i++)
    if (b[i] == '0') {
      ans += cnt2[i - 1][(a[i] - '0') ^ 1];
      ans += cnt[i + 1][(a[i] - '0') ^ 1];
    }
  printf("%lld\n", ans);
  return 0;
}
