#include<bits/stdc++.h>
#define maxn 4000005
#define int long long
using namespace std;



inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

int vis[26],n,ans;

string s;

signed main() {
	cin>>s;
	n=s.size();
//	vis[s[]]
	for(int i=s.size()-1;i>=0;i--) {
		if(i!=s.size()-1 && s[i]==s[i+1]) {
		 	for(int j=0;j<=25;j++) {
				if(j!=s[i]-'a') {
					ans+=vis[j],vis[s[i]-'a']+=vis[j],vis[j]=0;
				}
			}
		}
		vis[s[i]-'a']++;
	}
	cout<<ans<<endl;
	
	
	
}


#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
const int BUF = 2005;


int nVal;
int val[BUF];

void read() {
    cin >> nVal;
    for (int i = 0; i < nVal; ++i) {
        cin >> val[i];
    }
}


int gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a % b);
}


void work() {
    int minV = *min_element(val, val + nVal);
    map<int, int> divisor2gcd;
    
    for (int loop = 0; loop < nVal; ++loop) {
        int n = val[loop];
        for (int i = 1; i * i <= n; ++i) {
            if (n % i == 0) {
                int divisor[] = {i, n / i};
                for (int j = 0; j < 2; ++j) {
                    if (j == 1 && divisor[0] == divisor[1]) continue;
                    if (divisor[j] > minV) continue;
                    if (!divisor2gcd.count(divisor[j])) {
                        divisor2gcd[divisor[j]] = n / divisor[j];
                    } else {
                        divisor2gcd[divisor[j]] = gcd(n / divisor[j], divisor2gcd[divisor[j]]);
                    }
                }
            }
        }
    }

    int cnt = 0;
    for (map<int, int>::iterator it = divisor2gcd.begin(); it != divisor2gcd.end(); ++it) {
        cnt += it->second == 1;
    }
    cout << cnt << endl;
}


int main() {
    read();
    work();
    return 0;
}
