#include <type_traits>
#include <queue>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <limits>
#include <iostream>
namespace lc {
template <class CapacityType>
struct EdgeWithCapacity {
	int to;
	CapacityType capacity;
	EdgeWithCapacity() : to(0), capacity() { }
	EdgeWithCapacity(int to, const CapacityType &capacity)
		: to(to), capacity(capacity)
	{ }
};
}
namespace lc {
template <typename EdgeType>
class AdjacencyList {
public:
	typedef std::vector<EdgeType> ListType;
private:
	std::vector<ListType> m_lists;
public:
	explicit AdjacencyList(int n = 0)
		: m_lists(n)
	{ }
	int size() const { return m_lists.size(); }
	template <typename... Args>
	void add_edge(int u, Args&&... args){
		m_lists[u].emplace_back(args...);
	}
	const ListType &operator[](int u) const { return m_lists[u]; }
	ListType &operator[](int u){ return m_lists[u]; }
};
}
namespace lc {
template <class EdgeType>
struct ResidualEdge : public EdgeType {
	int rev;
	template <class... Args>
	ResidualEdge(int rev, Args&&... args)
		: EdgeType(args...)
		, rev(rev)
	{ }
};
template <class EdgeType>
class ResidualAdjacencyList
	: public AdjacencyList<ResidualEdge<EdgeType>>
{
public:
	explicit ResidualAdjacencyList(int n = 0)
		: AdjacencyList<ResidualEdge<EdgeType>>(n)
	{ }
};
template <class EdgeType>
ResidualAdjacencyList<EdgeType> make_residual(const AdjacencyList<EdgeType> &graph){
	typedef decltype(EdgeType().capacity) capacity_type;
	const int n = graph.size();
	ResidualAdjacencyList<EdgeType> result(n);
	for(int u = 0; u < n; ++u){
		for(const auto &e : graph[u]){
			const int v = e.to;
			const int rev_u = result[v].size();
			const int rev_v = result[u].size();
			result[u].emplace_back(rev_u, e);
			result[v].emplace_back(rev_v, e);
			result[v].back().to = u;
			result[v].back().capacity = capacity_type();
		}
	}
	return result;
}
}
namespace lc {
template <class EdgeType>
auto maxflow_dinic(
	int source, int sink, ResidualAdjacencyList<EdgeType> &graph)
	-> decltype(EdgeType().capacity)
{
	typedef decltype(EdgeType().capacity) capacity_type;
	const capacity_type inf = std::numeric_limits<capacity_type>::max();
	const int n = graph.size();
	capacity_type flow = 0;
	while(true){
		std::vector<int> level(n, -1);
		std::queue<int> q;
		level[source] = 0;
		q.push(source);
		while(!q.empty()){
			const int u = q.front();
			q.pop();
			for(const auto &e : graph[u]){
				const int v = e.to;
				if(e.capacity <= 0 || level[v] >= 0){ continue; }
				level[v] = level[u] + 1;
				q.push(v);
			}
		}
		if(level[sink] < 0){ break; }
		std::vector<size_t> iteration(n, 0);
		while(true){
			std::function<capacity_type(int, capacity_type)> dfs =
				[&](int u, capacity_type limit) -> capacity_type {
					if(u == sink){ return limit; }
					for(; iteration[u] < graph[u].size(); ++iteration[u]){
						auto &e = graph[u][iteration[u]];
						const int v = e.to;
						if(e.capacity <= 0 || level[u] >= level[v]){ continue; }
						const capacity_type diff =
							dfs(v, std::min(e.capacity, limit));
						if(diff > 0){
							e.capacity -= diff;
							graph[v][e.rev].capacity += diff;
							return diff;
						}
					}
					return 0;
				};
			const auto f = dfs(source, inf);
			if(f <= 0){ break; }
			flow += f;
		}
	}
	return flow;
}
}
using namespace std;
typedef lc::EdgeWithCapacity<int> Edge;
typedef pair<int, int> pii;
int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> ir(32);
	vector<pii> ranges(n);
	for(int i = 0; i < n; ++i){
		int a, b;
		cin >> a >> b;
		--a; --b;
		ranges[i] = pii(a, b);
		++ir[a];
		--ir[b + 1];
	}
	for(int i = 1; i <= 31; ++i){
		ir[i] += ir[i - 1];
	}
	lc::AdjacencyList<Edge> graph(n + 31 + 2);
	const int source = n + 31, sink = source + 1;
	for(int i = 0; i < n; ++i){
		graph.add_edge(source, i, 1);
		for(int j = ranges[i].first; j <= ranges[i].second; ++j){
			graph.add_edge(i, n + j, 1);
		}
	}
	for(int i = 0; i < 31; ++i){
		graph.add_edge(n + i, sink, 1);
	}
	auto residual = lc::make_residual(graph);
	const int f = lc::maxflow_dinic(source, sink, residual);
	int answer = f * 50;
	for(int i = 0; i < 31; ++i){
		if(ir[i] > 0){ answer += 50; }
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 1264