You are given strings s and t, both of length N. s and t consist of `0` and `1`. Additionally, in these strings, the same character never occurs three or more times in a row.

You can modify s by repeatedly performing the following operation:

* Choose an index i (1 \leq i \leq N) freely and invert the i-th character in s (that is, replace `0` with `1`, and `1` with `0`), under the condition that the same character would not occur three or more times in a row in s after the operation.



Your objective is to make s equal to t. Find the minimum number of operations required.

Constraints

* 1 \leq N \leq 5000
* The lengths of s and t are both N.
* s and t consists of `0` and `1`.
* In s and t, the same character never occurs three or more times in a row.

Input

Input is given from Standard Input in the following format:


N
s
t


Output

Find the minimum number of operations required to make s equal to t. It can be proved that the objective is always achievable in a finite number of operations.

Examples

Input

4
0011
0101


Output

4


Input

1
0
0


Output

0


Input

8
00110011
10101010


Output

10
#include<bits/stdc++.h>
using namespace std;
namespace io{
    const int l=1<<20;
    char buf[l],*s,*t,c;
    inline void gc(){
        if(s==t){
            t=(s=buf)+fread(buf,1,l,stdin);
            c=s==t?EOF:*s++;
        }else c=*s++;
    }
    template<class IT>inline void gi(IT &x){
        x=0;gc();while(c<'0'||c>'9')gc();
        while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^48);gc();}
    }
    char buf0[20];int a;
    template<class IT>inline void pi(IT x){
        if(x<0){putchar('-');x=-x;}
        do buf0[++a]=x%10+48;while(x/=10);
        while(a)putchar(buf0[a--]);
        putchar('\n');
    }
};
using io::gi;
using io::pi;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
typedef vector<int> vi;
typedef vector<ll > vl;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const int N=5005,M=15005;
int l[M],r[M];
char s[N];
inline int myabs(int a){return a<0?-a:a;}
int main(){
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n,i,j,x,ans,t;
    scanf("%d%s",&n,s+1);ans=1000000000;
	x=(s[1]=='1')?n+1:n;
    REP(i,1,n)if(s[i]!=s[i+1])l[++x]=i;
	REP(x,x+1,M)l[x]=n;
    scanf("%s",s+1);
	x=(s[1]=='1')?n+1:n;
    REP(i,1,n)if(s[i]!=s[i+1])r[++x]=i;
	REP(x,x+1,M)r[x]=n;
	//rep(i,0,20)printf("%d ",l[i]);puts("");
	//rep(i,0,20)printf("%d ",r[i]);puts("");
	for(x=0;x<=n;x+=2){
		t=0;
		for(i=x,j=0;i!=M;++i,++j)t+=myabs(l[i]-r[j]);
		//printf("l<<%d t=%d\n",x,t);
		cmin(ans,t);
	}
	for(x=2;x<=n;x+=2){
		t=0;
		for(i=x,j=0;i!=M;++i,++j)t+=myabs(l[j]-r[i]);
		//printf("l>>%d t=%d\n",x,t);
		cmin(ans,t);
	}
	printf("%d",ans);
    return 0;
}