contract hasHolders {
    //    using SafeMath for uint256;

    struct Holder {
        uint256 id; //порядковый номер
        uint256 holderSince;
    }

    mapping(address => Holder) holders;
    // внимание! id холдера начинаются с 1!
    mapping(uint256 => address) holdersId;
    uint256 public holderCount = 0;

    event AddHolder(address indexed holder, uint256 index);
    event DelHolder(address indexed holder);
    event UpdHolder(address indexed holder, uint256 index);

    function _addHolder(address _holder) internal returns (bool) {
        if (holders[_holder].id == 0) {
            holders[_holder].id = ++holderCount;
            holders[_holder].holderSince = now;
            holdersId[holderCount] = _holder;
            AddHolder(_holder, holderCount);
            return true;
        }
        return false;
    }

    function _delHolder(address _holder) internal returns (bool){
        uint256 id = holders[_holder].id;
        if (id != 0 && holderCount > 0) {
            //replace with last
            holdersId[id] = holdersId[holderCount];
            // delete Holder element
            delete holders[_holder];
            //delete last id and decrease count
            delete holdersId[holderCount--];
            DelHolder(_holder);
            UpdHolder(holdersId[id], id);
            return true;
        }
        return false;
    }

    // внимание! id холдера начинаются с 1!
    function getHolder(uint256 _id) external view returns (address) {
        return holdersId[_id];
    }

    function getHoldersCount() external view returns (uint256) {
        return holderCount;
    }

    //    function getHolderId(address _holder) public constant returns (uint256) {
    //        return holders[_holder].id;
    //    }
}
function getHolder(uint256 _id) external view returns (address) {
        return holdersId[_id];
    }
// внимание! id холдера начинаются с 1!