// WanderingPaperboy.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <fstream>
#include <algorithm>
#include <set>

using namespace std;

int main()
{
    set<pair<int, int>> housesVisited;
    int x = 0, y = 0;
    housesVisited.emplace(make_pair(x, y));

    ifstream readFile("input.txt");
    char c;

    while (readFile >> c)
    {
        if (c == '^')
        {
            y++;
        }
        else if (c == 'v')
        {
            y--;
        }
        else if (c == '<')
        {
            x--;
        }
        else if (c == '>')
        {
            x++;
        }

        housesVisited.emplace(make_pair(x, y));
    }

    cout << housesVisited.size();

}
