#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define fi first
#define se second
#define mset(a,b) memset(a, b, sizeof(a))
#define dbg(x) cout << "[" << #x << "]: " << x << endl;
#define forn(i,n) for(int i=0; i < n;i++)
#define forab(i,a,b) for(int i = a; i <= b; i++)
#define forba(i,b,a) for(int i = b; i >= a; i--)
#define each(val, v) for(auto val : v)
#define abs(u) (u >= 0 ? u : -u)

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

const int MAXN = 2e5 + 5;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;

ll cnt[MAXN][26];

void solve(){
    string s;
    cin >> s;
    ll n = s.size();

    forn(i,26){
        cnt[n][i] = 0;
    }
    
    ll ans= 0;
    for(int i = n-2; i >= 0; i--){
        ll d1 = s[i] - 'a';
        ll d2 = s[i+1] - 'a';
        if(d1 == d2){
            ans += n - (i+2) - cnt[i+2][d1];
            forn(j,26){
                cnt[i+2][j] = 0;
            }
            cnt[i+2][d1] = n - (i+2);
        }

        forn(j,26){
            cnt[i+1][j] = cnt[i+2][j];
        }
        cnt[i+1][ s[i+1] - 'a' ]++;

        

    }

    cout << ans << endl;
}

int main(){

    ios::sync_with_stdio(false); cin.tie(NULL);

    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }

    return 0;
}
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int

struct Union{
  vector<ll> par;
  Union(ll a){
  par=vector<ll>(a,-1);
  }
  ll find(ll a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(ll a,ll b){
    return (find(a)==find(b));
  }
  ll size(ll a){
    return -par[find(a)];
  }
  void unite(ll a,ll b){
    ll c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
ll euclidean_gcd(ll a, ll b) {
  if(a < b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
ll euclidean_lcm(ll a, ll b) {
  return a/euclidean_gcd(a,b)*b;
}
int main(void){
  ll n,k=0;
  cin >> n;
  rep(i,200000000){
    if((n-(i+1)*(i+2)/2)%(i+1)==0&&n/(i+1)-(i/2)>0)k++;
  }
  cout << k*2 << endl;
}