#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0); cout.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  if(N < 3) {
    cout << 0 << '\n';
  } else {
    set<int> st;
    for(int i = 2; i * i <= N; i++) {
      if(N % i == 0) {
        st.insert(i);
        st.insert(N / i);
      }
    }
    cout << N - (int) st.size() - 2 << '\n';
  }
  return 0;
}