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>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
using namespace std;
const int N=5005;
char s[N],t[N];
int q1[N],q2[N];
int n,ans;
void check(int p1,int p2){
	int S=0;
	For(i,1,p1-1) S+=q1[i];
	For(i,1,p2-1) S+=q2[i];
	for (;p1<=*q1&&p2<=*q2;++p1,++p2)
		S+=abs(q1[p1]-q2[p2]);
	For(i,p1,*q1) S+=n-q1[i];
	For(i,p2,*q2) S+=n-q2[i];
	ans=min(ans,S);
}
void getop(char *s,int *q,int *tp){
	For(i,0,n) if (s[i]!=s[i+1])
		q[++*q]=i,tp[i]=s[i]&1;
}
int main(){
	ans=1<<30;
	scanf("%d%s%s",&n,s+1,t+1);
	s[0]=97-s[1]; s[n+1]=97-s[n];
	t[0]=97-t[1]; t[n+1]=97-t[n];
	For(i,0,n) if (s[i]!=s[i+1]) q1[++*q1]=i;
	For(i,0,n) if (t[i]!=t[i+1]) q2[++*q2]=i;
	For(i,1,*q1) if (s[q1[i]]==t[q2[1]]) check(i,1);
	For(i,1,*q2) if (s[q1[1]]==t[q2[i]]) check(1,i);
	printf("%d",ans);
}