#include<bits/stdc++.h>

using namespace std;

int pole[26];

int main(){
  int n;
  cin >> n;
  string str;
  cin >> str;
  int mx = -1;
  for(int i = 0; i < n;i++){
    pole[str[i] - 'a']++;
    int od = 0, ev = 0;
    for(int j = 0; j < 26;j++){
      if(pole[j]%2 == 0){
	ev++;
      }
      else{
	od++;
      }
    }
    if(od == 1 || od == 0){
      mx = i;
    }
  }
  cout << mx + 1 << endl;
}

