#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;

//建立哈希表,作为积分表
unordered_map<string, int> standings;

void insertOrUpdateScore(const string &name, int score)
{
    // TODO: 实现插入或更新逻辑
    standings[name] = score;
    cout << "OK" << endl;
}

void queryScore(const string &name)
{
    // TODO: 实现查询逻辑
    if(!standings.count(name)){
        cout << "Not found" << endl;
    }
    else{
        cout << standings[name] << endl;
    }
}

void deletePlayer(const string &name)
{
    // TODO: 实现删除逻辑
    if(!standings.count(name)){
        cout << "Not found" << endl;
    }
    else{
        standings.erase(name);
        cout << "Deleted successfully" << endl;
    }
}

void countPlayers()
{
    // TODO: 实现统计逻辑
    cout << standings.size() << endl;
}

























































































































































































































int main()
{
    // 提高输入输出效率 (可选)
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int q;
    cin >> q;

    while (q--)
    {
        int op;
        cin >> op;

        if (op == 1)
        {
            string name;
            int score;
            cin >> name >> score;
            insertOrUpdateScore(name, score);
        }
        else if (op == 2)
        {
            string name;
            cin >> name;
            queryScore(name);
        }
        else if (op == 3)
        {
            string name;
            cin >> name;
            deletePlayer(name);
        }
        else if (op == 4)
        {
            countPlayers();
        }
    }

    return 0;
}