#include <bits/stdc++.h>
using namespace std;
int getCount(int n,vector<int>v,int k){
	int count=0;
	int sum=0;
	int i=0;
	for(int j=0;j<n;j++){
		sum+=v[j];
		while(sum>k){
			sum=sum-v[i];
			i++;
		}
		count=count+(j-i+1);
	}
	return count;
}
 
int main() {
	// your code goes here
	int n;
	cin>>n;
	vector<int>v(n,0);
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	int k;
	cin>>k;
	cout<<"The number of subarray with sum less than k is:"<<getCount(n,v,k);
	return 0;
}