#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)

constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int main() {
  ll n;
  cin >> n;

  ll ans = INFL;
  auto d = [](ll x) {
    ll res = 0;
    while (x) {
      res++;
      x /= 10;
    }
    return res;
  };
  for (ll i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      ll a = d(i);
      ll b = d(n / i);
      ll f = max(a, b);
      ans = min(ans, f);
    }
  }
  cout << ans << endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){
#ifdef LOCAL
	freopen("inp.txt", "r", stdin );
	freopen("ans.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	if(s=="SUN") cout << 7 << '\n';
	if(s=="MON") cout << 6 << '\n';
	if(s=="TUE") cout << 5 << '\n';
	if(s=="WED") cout << 4 << '\n';
	if(s=="THU") cout << 3 << '\n';
	if(s=="FRI") cout << 2 << '\n';
	if(s=="SAT") cout << 1 << '\n';
}
