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

unordered_map<string, int> playerScores;

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

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

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

void countPlayers() {
    // TODO: 实现统计逻辑
    cout << playerScores.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;
}