# Drawstep engine · Values · `count` > Count — e.g. “the number of permanents on the battlefield”. Engine: Magic: The Gathering (`mtg`). This is one primitive of the Drawstep card vocabulary; field names and the discriminator are exact. Wiki page: https://drawstep.xyz/wiki/mtg/values#count ## Where it goes A number: `{ "kind": "count", … }` wherever a ValueDef is accepted (`amount`, `power`, `max`, `count` …); a plain integer is also a ValueDef. Printed words that point here (search aliases): number of for each equal to the number of. ## Fields | Field | Type | Required | Description | |---|---|---|---| | `digSubset` | `"looked" \| "picked" \| "rest"` | no | Use the last dig's fixed subset and action-time characteristics; zone restricts actual disposition, excluding replaced moves (CR 608.2h, 609.3, 400.7) | | `of` | `"object" \| "player"` | no | Count objects (default) or players | | `zone` | `"battlefield" \| "hand" \| "graveyard" \| "library" \| "exile" \| "stack" \| "command"` | no | Zone counted (default battlefield) | | `filter` | `ObjectFilter` | no | Which objects are counted | | `player` | `"you" \| "controller" \| "abilityController" \| "sourceController" \| "owner" \| "eachOpponent" \| "eachPlayer" \| "target" \| "triggeringPlayer" \| "defendingPlayer" \| "attackingPlayer" \| "activePlayer" \| "re …` | no | Whose zone is counted (on the battlefield: controller; elsewhere: owner) | ## Minimal form ```json {"kind":"count"} ``` The engine reads that minimal form as: “the number of permanents on the battlefield”. ## Stock examples - **Humming-** — “Whenever you attack with two or more creatures,” ```json {"kind":"count","filter":{"controller":"you","attacking":true}} ``` - **Avenger of the Fallen** — “Mobilize X, where X is the number of creature cards in your graveyard.” ```json {"kind":"count","zone":"graveyard","filter":{"types":["Creature"]},"player":"you"} ``` - **Enchantment Condition Study** — “” ```json {"kind":"count","filter":{"types":["Enchantment"]}} ``` ## Related - [Values](https://drawstep.xyz/wiki/mtg/values.md) — the whole topic - [Filters & targets](https://drawstep.xyz/wiki/mtg/targets.md) — how `target` / `filter` select objects and players (selection algebra) - [Start here](https://drawstep.xyz/wiki/mtg/start.md) — the rules, the output contract and the index of every primitive