#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
constexpr int INF = 1001001001;
constexpr long long INFL = (1LL<<60);
constexpr double eps = (1e-9);

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string s;
  cin >> s;
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] != '0') break;
    else s.pop_back();
  }

  string r = s;
  reverse(r.begin(), r.end());

  if (r == s) puts("Yes");
  else puts("No");

  return 0;
}

#include <iostream>
#include <vector>

#define int long long

signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  int n;
  std::cin >> n;

  int dp[n+1];
  dp[0] = 0;
  std::vector<int> poss(26, n+1);

  std::string s;
  std::cin >> s;

  for(int i = 1; i <= n; i++) {
    int j = s[i-1]-'a';
    dp[i] = n+1;
    for(int k = 0; k < 26; k++) {
      if(k == j)
        continue;
      dp[i] = std::min(dp[i], 1 + poss[k]);
    }
    if(dp[i-1] != n+1)
      poss[j] = std::min(poss[j], dp[i-1]);
  }

  if(dp[n] >= n+1)
    std::cout << -1 << std::endl;
  else
    std::cout << dp[n] << std::endl;

  return 0;
}

