#include<iostream>
#include<map>
using namespace std;

int main(){
    map<string, int> weekday;
    weekday["SUN"] = 0;
    weekday["MON"] = 1;
    weekday["TUE"] = 2;
    weekday["WED"] = 3;
    weekday["THU"] = 4;
    weekday["FRI"] = 5;
    weekday["SAT"] = 6;

    string day;
    std::cin >> day;

    std::cout << 7 - weekday[day];

}
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	ll n; cin >> n;
	int ans=log10(n)+1;
	for(int i=1;i<=sqrt(n);i++){
		if(n%i==0){
			ans=max(log10(i)+1,log10(n/i)+1);
		}
	}
	cout << ans << endl;
	return 0;
}