Just decrease the number deducting the iteration variable

```
public int arrangeCoins(int n) {
if(n==1) return 1;
int count = 0;
for(int i=1;i<=n;i++){
if(n>=i) {
count++;
n -= i;
}
}
return count;
}
```