#include <bits/stdc++.h>
int main() {
  int a, b, c, cnt = 0;
  scanf("%d %d %d", &a, &b, &c);
  if (c % a == 0 && c % b == 0) {
    cnt = 2;
  } else if (c % a == 0 || c % b == 0) {
    cnt = 1;
  } else {
    cnt = 0;
  }
  printf("%d\n", cnt);
  return 0;
}
