# ee.Number.bitCount

Calculates the number of one-bits in the 64-bit two's complement binary representation of the input.

<br />

| Usage | Returns |
|---|---|
| `Number.bitCount()` | Number |

| Argument | Type | Details |
|---|---|---|
| this: `input` | Number | The input value. |

## Examples

### Code Editor (JavaScript)

```javascript
print(ee.Number(0).bitCount());       // [0]
print(ee.Number(1).bitCount());       // [1]
print(ee.Number(2).bitCount());       // [1]
print(ee.Number(3).bitCount());       // [2]
print(ee.Number(0xFFFF).bitCount());  // [16]

// https://en.wikipedia.org/wiki/Two's_complement signed values.
print(ee.Number(-1).bitCount());                       // [64]
print(ee.Number(-1, ee.PixelType.int8()).bitCount());  // [64]
print(ee.Number(-2).bitCount());                       // [63]
```
Python setup

See the [Python Environment](https://developers.google.com/earth-engine/guides/python_install) page for information on the Python API and using
`geemap` for interactive development.

```python
import ee
import geemap.core as geemap
```

### Colab (Python)

```python
display(ee.Number(0).bitCount())       # [0]
display(ee.Number(1).bitCount())       # [1]
display(ee.Number(2).bitCount())       # [1]
display(ee.Number(3).bitCount())       # [2]
display(ee.Number(0xFFFF).bitCount())  # [16]

# https://en.wikipedia.org/wiki/Two's_complement signed values.
display(ee.Number(-1).bitCount())                       # [64]
display(ee.Number(-1).toInt8().bitCount())              # [64]
display(ee.Number(-2).bitCount())                       # [63]
```