#include <bits/stdc++.h>
using namespace std;
int nsize;
string a, b;
int main() {
  scanf("%d", &nsize);
  cin >> a;
  cin >> b;
  long long one = 0, zero = 0;
  int i = 0;
  while (i < nsize) {
    if (a[i] == '1') one++;
    if (a[i] == '0') zero++;
    i++;
  }
  long long ans = 0;
  long long cnt1 = 0, cnt2 = 0;
  i = 0;
  while (i < nsize) {
    if (a[i] == '0' && b[i] == '0') {
      long long temp = one - cnt2;
      if (temp < 0) temp = 0;
      ans += temp;
      cnt1++;
    } else if (a[i] == '1' && b[i] == '0') {
      int temp = zero - cnt1;
      if (temp < 0) temp = 0;
      ans += temp;
      cnt2++;
    }
    i++;
  }
  printf("%lld\n", ans);
  return 0;
}
