#include <iostream>
#include <string>
using namespace std;
int main(){
int n;
string str, res;
cin>>n>>str;
//找规律 模拟
int j = 0;
for(int i = 0; i < n; ++i){
str[j++] = str[i];
while(j >= 2 && ((str[j-1]=='1' && str[j-2]=='0')||(str[j-1]=='0' && str[j-2]=='1'))) j-=2;
}
cout<<j<<endl;
return 0;
}