#include<bits/stdc++.h>
using namespace std;
const int N=1010;
struct node{
int l,r,t;
}e[N];
int n;
bool cmp(node a,node b){
return a.r<b.r;
}
int a[N];
int main(){
freopen("tower.in","r",stdin);
freopen("tower.out","w",stdout);
cin >> n;
for(int i=1;i<=n;i++) cin >> e[i].l >> e[i].r >> e[i].t;
sort(e+1,e+1+n,cmp);
int ans=0;
for(int i=1;i<=n;i++){
int cnt=e[i].t;
for(int j=e[i].l;j<=e[i].r;j++)
if(a[j])cnt--;
int pos=e[i].r;
for(int j=1;j<=cnt;j++){
while(a[pos]) pos--;
a[pos]=1;
pos--;
ans++;
}
}
cout << ans;
return 0;
}
我是蓝鳍金枪鱼,暗区突围(v区)搜:天下我卢哥