#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <iostream>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <complex>

#define mp(a, b) make_pair((a), (b))
#define pb(a) push_back((a))
#define pf(a) push_front((a))
#define rb() pop_back()
#define rf() pop_front()
#define sz(a) ((int)a.size())

using namespace std;

typedef long long lld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;
typedef pair<lld, int> pli;
typedef pair<int, lld> pil;
typedef vector<vector<int>> Matrix;
typedef vector<vector<int>> Adj;
typedef vector<int> Row;
typedef complex<double> Complex;
typedef vector<Complex> Vcomplex;

const int MOD = 1e9 + 7;
const int INF = 1e9;
const lld LINF = 1e18;
const double FINF = 1e15;
const double EPS = 1e-9;
const double PI = 2.0 * acos(0.0);

set<pii> chk; 
const int M1 = 1e9 + 7;
const int M2 = 1e5 + 3;
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); ++i) {
    int H1 = 0, H2 = 0;
    for (int j = i; j < s.size(); ++j) {
      int c = s[j] - 'a' + 1;
      H1 = (27ll * H1 + c) % M1;
      H2 = (27ll * H2 + c) % M2;
      chk.insert(pii(H1, H2));
    }
  }
  cout << chk.size() << '\n';
}
