```
public class Solution {
public int minSteps(int n) {
if(n == 1) return 0;
int factor = (int)Math.sqrt(n);
while(factor > 1) {
if(n % factor == 0) return minSteps(factor) + minSteps(n/factor);
factor--;
}
return n;
}
}
```