---
# System prepended metadata

title: 11592 - Change the Cap
tags: [recursion]

---

# 11592 - Change the Cap
>author: Utin
###### tags: `recursion`

---

## Brief
See the code below

## Solution 0

```c=
#include <stdio.h>

int extra(int n);

int main() {
    int n;
    scanf("%d", &n);
    printf("%d\n", n - extra(n));
}

int extra(int n) {
    if (n <= 4) return n / 4;
    return n / 4 + extra(n / 4 + n % 4);
}

// By Utin
```

## Solution 1

```c
#include <stdio.h>

int main() {
    int N, n, extra = 0;
    scanf("%d", &N);
    n = N;
    while (n) {
        extra += n / 4;
        n = (n < 4) ? (n / 4) : (n / 4 + n % 4);
    }
    printf("%d\n", N - extra);
}

// By Utin
```

## Reference