```
public int minSteps(int n) {
if (n == 1) {
return 0;
}
int res = n;
for (int i = 2; i < n; i++) {
if (n % i == 0) {
res = i + minSteps(n/i);
break;
}
}
return res;
}
```